Andrew McHorney wrote:I just installed the latest JDK for Java. I did a check on my windows environment variables and I noticed that the class path is not the path that I installed Java into.
The classpath is what Java uses to find *.class files, but the standard Java library does not need to be in the classpath - Java always includes that automatically. Your classpath should
not include the directory where you installed the JDK - that's not normally a directory where you would save your *.class files. As Campbell says, when you install the JDK, it doesn't set a CLASSPATH environment variable, and it's recommended not to set it at all. If CLASSPATH is not set, Java will by default look in the current directory for class files.
If you need to set a classpath for running your program, set it on the command line by using the -cp or -classpath option instead of setting a CLASSPATH environment variable.
The reason why it's better to not use the CLASSPATH environment variable is because it affects all Java programs that you run on your system, which is usually not what you'd want.