
The perspective is opened.
1. Create the Application Client Project
Choose from the main menu.
Select , then choose Next .
Enter CalculatorServiceClient in the Project Name field.
Leave the Default Configuration for SAP Libraries in the Configurations field. The default configurations include the Application Client Module 5.0 and Java 6.0 project facets.
To assign the Application Client project to an Enterprise Application project, choose Add project to an EAR and select CalculatorServiceEAR in the EAR Project Name field.
Choose Finish to create the Application Client project.
2. Implement the Application Client
Copy the Java source below.
Expand the project CalculatorServiceClient .
From the context menu of appClientModule folder, choose Paste .
package com.sap.blogs.appclient.calculator.client;
import com.sap.blogs.appclient.calculator.ejb.CalculatorRemote;
import javax.ejb.EJB;
public class CalculatorClient {
@EJB
private static CalculatorRemote calculator;
/**
* Creates a new instance of Starter
*/
public CalculatorClient() {
}
/**
* @param args
* the command line arguments
*/
public static void main(String[] args) {
System.out.println("Welcome to calculator service!");
System.out.println();
System.out.print("Adding (4+6): ");
long result = calculator.add(4, 6);
System.out.println(result);
}
}
A peculiarity of all Application Client applications is that they have to specify their main class in the archive's manifest file. Open META-INF/MANIFEST.MF and append:
Main-Class: com.sap.blogs.appclient.calculator.client.CalculatorClient
3. Configure the Project References
Since your Application Client project uses resources from the CalculatorServiceEJB project, you have to set these references:
Select CalculatorServiceClient in the Project Explorer .
From the context menu, choose Properties .
On the Properties for CalculatorServiceClient screen, select the Java Build Path node, then choose the Projects tab.
Choose Add .
Select CalculatorServiceEJB .
Choose OK .
Select the Project References node.
On the Setting Java Build Path screen that pops up, choose Apply .
Select the CalculatorServiceEAR and the CalculatorServiceEJB projects.
Choose OK .
Next Step