HomeDocumentation > Sample applications > Deploy and run J2EE Application Client

You can create an application client that run into the Apache Geronimo application client container rather than running in your computer.

You only need to create a jar file with these files for a simple example that only will write "CLIENT RUNNING..." by console:

1. - client/MainClient.java

2. - META-INF/application-client.xml

3. - META-INF/geronimo-application-client.xml

You need to define two modules, one for client side and one for server side. EXAMPLEClientServer is the component that always its going to be running, and EXAMPLEClient its the comonent that you are going to start with client.jar util.

4. - META-INF/MANIFEST.MF

Manifest-Version: 1.0
Main-Class: client.MainClient
\# blank line

MANIFEST must contain the Main-Class and blank line at the end of the file.

With this bat file, you can create the J2EE application client jar file (I named it app_client.jar) if you have the compiled files and xml files and the our manifest.mf into one folder (in my case D:\workspace2\GERONIMO_APPLICATION\bin). The M jar command´s paramenter indicate that jar file must be created ussing our MANIFEST.MF file. Verify that this is correct after create jar file.

jar -cfM  app_client.jar -C D:\workspace2\GERONIMO_APPLICATION\bin .
java -jar %GERONIMO_HOME%/bin/deployer.jar --user system --password manager --host localhost undeploy JEE5/EXAMPLEClient/1.1/car
java -jar %GERONIMO_HOME%/bin/deployer.jar --user system --password manager --host localhost undeploy JEE5/EXAMPLEClientServer/1.1/car
java -jar %GERONIMO_HOME%/bin/deployer.jar --user system --password manager deploy app_client.jar
pause

After deploy, you have to see the two components into Geronimo Web Console -> Applications -> App Clients:

JEE5/EXAMPLEClient/1.1/car    	   state: stopped
JEE5/EXAMPLEClientServer/1.1/car   state: running

You can run Application client with this command:

java -jar %GERONIMO_HOME%/bin/client.jar JEE5/EXAMPLEClient/1.1/car