On Saturday 29 May 2004 12:16 pm, Michael Sullivan wrote: > First off, I'm not sure if this is a java problem or a Linux problem. > If you think it's a Java problem, tell me and I'll send this question to > a Java list. I wrote a java server that I want to start every time my > server PC restarts. I created a /usr/local/classes directory and copied > Server.class and the support classes it uses there. Id cd'd to > /usr/local/classes and issued a java Server from there and it works > fine, but if I issue a java /usr/local/classes/Server from anywhere > outside the /usr/local/classes directory it tells me > > Exception in thread "main" java.lang.NoClassDefFoundError: > /usr/local/classes/Server > > > I don't think this is a java problem because it doesn't give me this error > if I ask to run the Server from within /usr/local/classes. I've tried > editing rc.local to say "cd /usr/local/classes" and then "java Server" and > I've tried calling an executable batch file from rc.local that cd's to the > /usr/local/classes directory and then "java Server", which works from the > command line, but doesn't work after reboot. Can anyone help me? Try the following: set the environment variable CLASSPATH to /usr/local/classes so that Java knows where to find your classes. Asumming you're using bash: $> export CLASSPATH=$CLASSPATH:/usr/local/classes then try to run your application from outside the directory. If it starts fine, then put that also in rc.local: export CLASSPATH=$CLASSPATH:/usr/local/classes java /usr/local/classes/Server Basically, java need to know where to find the classes. If you're in the directory itself, then it defaults to find the classes in the current directory. If you're running the program from outside directory, you need to tell it where to find the java classes, hence the CLASSPATH environment variable. HTH RDB -- Reuben D. Budiardja Department of Physics and Astronomy The University of Tennessee, Knoxville, TN --------------------------------------------------------- "To be a nemesis, you have to actively try to destroy something, don't you? Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." - Linus Torvalds - -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list