aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes J2EE & client applications. HELP PLEASE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "J2EE & client applications. HELP PLEASE" Watch "J2EE & client applications. HELP PLEASE" New topic
Author

J2EE & client applications. HELP PLEASE

Ayad Hindi
Greenhorn

Joined: Jun 27, 2002
Posts: 14
Hello to everyone!!
I have a couple of questions on running a client application using j2ee.
Most of the documentation and tutorials on J2EE focus on JEBs servlets and JSPs, but almost nothing on standalone client applications, if you my friends could please help me.
Ok, here are the questions.
1. My project is a web based backup system intended for the "naive" users, i.e. those who dont know much about computers. So according to the j2ee tutorial, to run a client application you need to set up an enviromental variable to the client jar. Is there any way of running the cilent without having to set the classpath?
2. So far I have tested my client on the same machine as the server - I am using j2ee reference implementation - and I some how have the feeling that running it from a different machine would have to be different. ie. when I run it from the same machine I do not say at any point the address of the server e.g. http://130.88.172.17:8000. So the question is how do I run the client from a different machine?
3. To run the client you have to go the dos promt and type runclient -client backupApp.ear -name Client. Is there any opssibility of running the client by simple double clicking the client jar file? or some other mecanism that would only require to double click a file?
4. When I run the client it asks me for a login and password to connect to the j2ee server. I would rather do this internally so a user does not need to do absolutely nothing to get his files backed up, so I guess the question is, can anyone point me how to implement a client call back handler to handle the connection for the user?
My last question does not really have to do with j2ee but here it goes anyway:
5. The client's jar file has a xml file holding some information about the user such as login password etc. This file has to be accessed by the program, but when I run it it looks for the file in the clients file system, rather than inside the jar. Could anyone tell me how my code could access the file inside the jar?
ok, lots of questions as you can see, but I am really unable to find a source for information. If anyone could tell me about a book or tutorial that talks about these I would me most grateful.
Please do reply for this forum is currently my only source for information.
Thanks in advanced.
Ayad Hindi
[ August 07, 2002: Message edited by: Ayad Hindi ]
Mat Robinson
Greenhorn

Joined: Aug 02, 2002
Posts: 20
You may want to look at the manifest file of the jar file that you are running, from here it is possible to set the classpath and the main-class (the class to run when double-clicked).
Example:

This should certainly give you a starting point for some of your questions.
Hope this helps,
Mat.
Ayad Hindi
Greenhorn

Joined: Jun 27, 2002
Posts: 14
Cheers Mat for you reply.
I used what you said, and it seems to work, although i am not quite sure. Basically when I double click the file, nothing happens. I think it because I do not have an applet or any GUI, but I am not sure if that is the problem.
I know that my system can execute jar by doble clicking because I downloaded one and when I double clicked it, the GUI appeared. Thats why my guess is that because I do not have a GUI I cannot see if its working.
Is there anyway of specifying that its an application and that a dos prompt or something should be opened to see the system.out statments?
Thanks in advanced
Ayad Hindi
Mat Robinson
Greenhorn

Joined: Aug 02, 2002
Posts: 20
Right assuming that your class has a main method, then you can try calling java -jar test.jar where test.jar is the jar you are testing
This will use the classpath and main-class stuff on a command line, then anything should be written to the system.out as normal.
Mat.
Ayad Hindi
Greenhorn

Joined: Jun 27, 2002
Posts: 14
Hi Mat,
I tried what you said and it works, I can run my code with java -jar test.jar. It works just fine, printing out everything, but I guess the question is can I run such a jar file just by double clicking.
Ayad Hindi
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: J2EE & client applications. HELP PLEASE