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\rt.java;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 me...at one point, I was doing a form or dynamic classloading using file protocol...I am not doing that any more...do 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 Files....directory because I was afraid maybe that was contributing a hidden path somewhere...but, now that it is gone...my program still works. Any insights would be appreciated. thanks, Richard
Joined: Aug 21, 2001
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
Joined: Apr 06, 2002
Hi Sid, Yes, what you say I was sort of thinking...it 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 searchpath...it 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 classpath...it 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... Richard
Joined: Feb 25, 2002
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.