pmdkh
December 16th, 2007, 02:52 AM
You read it right. I don't understand why something is working.
I recently installed Xubuntu 7.10 on a flash drive, and I've been messing around with setting up Java. I got everything working correctly, and because of a stupid mistake of my own*, I started messing around with the CLASSPATH variable.
I ended up removing the CLASSPATH variable, and I am able to compile and run Java programs. I don't even have the current directory (./) set for the CLASSPATH, and I am able to run programs that call on different Java classes. I also don't use the -cp option for the java and javac commands.
So my question is, how does Java know where to look for other classes if I don't have CLASSPATH set?
Thanks for the help.
*The stupid mistake was trying to use a method from the Math class (java.lang.Math) in a program named Math.java. For quite a while I couldn't understand why it couldn't find the function, until it finally hit me.
I recently installed Xubuntu 7.10 on a flash drive, and I've been messing around with setting up Java. I got everything working correctly, and because of a stupid mistake of my own*, I started messing around with the CLASSPATH variable.
I ended up removing the CLASSPATH variable, and I am able to compile and run Java programs. I don't even have the current directory (./) set for the CLASSPATH, and I am able to run programs that call on different Java classes. I also don't use the -cp option for the java and javac commands.
So my question is, how does Java know where to look for other classes if I don't have CLASSPATH set?
Thanks for the help.
*The stupid mistake was trying to use a method from the Math class (java.lang.Math) in a program named Math.java. For quite a while I couldn't understand why it couldn't find the function, until it finally hit me.