File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Got an interesting problem...I think? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Got an interesting problem...I think?" Watch "Got an interesting problem...I think?" New topic

Got an interesting problem...I think?

Richard denSeig
Ranch Hand

Joined: Apr 06, 2002
Posts: 32
Hi all,
I have been working on various documentation to go with my assignment...oh so near to completion...
I was prompted to do some fiddling with environmental settings to see how slim my program could run...and to my surprise, I found that my client and server work with no classpath?!?!
my environment is as follows:
Windows 2000 Pro...
environment classapth=C:\dev\java\j2se131\jre\lib\;C:\dev\cert
I have moved jars to a dir not in the paths above...C:\testing\test and I manually 'set classpath=""'...then I just execute the server.jar or client.jar using java with a -D for policy and it works...
This concerns one point, I was doing a form or dynamic classloading using file protocol...I am not doing that any to some very good comments from Mark, and Sai and others.
So, why is my code working, when I think it should not...
Oh, I have removed the java RTE that was deployed in the Program because I was afraid maybe that was contributing a hidden path somewhere...but, now that it is program still works.
Any insights would be appreciated.
Siddharth Mehrotra
Ranch Hand

Joined: Aug 21, 2001
Posts: 185
hi Richard,
guess what, you have just now discovered the power of relative path.
you have two jars now client and server. You have all the classes in the two jars in packages and you when u execute the jar, it calls the main starting class that u have specefied in the mainfest file.
so after that if that main file has to instantiate any other class it just tries to find them from the imports that u have done.
infact to make it a bit simpler the files that are enclosed in the jar, work in a world of thire own. So they dont need any classpath settings that u have in your system

Richard denSeig
Ranch Hand

Joined: Apr 06, 2002
Posts: 32
Hi Sid,
Yes, what you say I was sort of certainly makes sense...but, here is another question: I have read here of how many people working on same project are having lots of trouble with their classpath settings
Also, in the assignment there is a blurb about "...add the server.jar to your classpath. You should tell exactly how to add the jar to classpath..." or something to that effect.
I understand that the instruction is to give precise details of adding to classpath...but, if gives the impression that this is a necessary part of assignment.
As I have discovered, my assignment only requires that java.exe and rmiregistry.exe are in has no need of external classpath as the jars provide all classess.
Is this what others have found? Sure does leave me with a large doubt about this.
I am experienced with developing programs and am used to having paths and classpath issues to be resolved and the subtlties of classpath settings and bootpath settings.

This is the first jar file I have ever packaged and made executeable...and though it is really nice to be able to deploy all most anywhere without having to setup worry to much about environment issues like feels like something is wrong...I just hope, it will work the same on the evaluator's machine...

If you could speak to the other questions/concerns I have here, maybe I can get warm and fuzzies about this.
thanks for you reply as it does help...
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Since dynamic downloading of _Stub classes is not possible for the RMI registry in this assignment, the CLASSPATH for the RMI Registry needs to be set. I guess this is what mentioned in the requirements document as "setting CLASSPATH" or someting to that effect.
As far as executing the server or client, executable jar should be fine. I haven't made that decision yet.
I agree. Here's the link:
subject: Got an interesting problem...I think?
It's not a secret anymore!