In most cases, this is not only good practice, but a must .
consider a Java class named:
com.example.Hello
If you store it in the file system, it should get to
/path/to/my/classes/com/example/Hello.java
The compiler (or at least the vast majority) will create a class file in
/path/to/my/classes/com/example/Hello.class
Personally, I would not use the CLASSPATH variable to set the path, but the -cp parameter in java. A call to the above βapplicationβ can be made using:
java -cp /path/to/my/classes com.example.Hello
source share