The path for all user-defined packages and libraries must be set in the command-line (or in the Manifest associated with the Jar file containing the classes).
The file structure looks like this: When we invoke Java, we specify the name of the application to run: org.mypackage.HelloWorld.
For the above example, we could also use on Windows: The rule is that -classpath option, when used to start the java application, overrides the CLASSPATH environment variable.
If a program uses a supporting library enclosed in a Jar file called supportLib.jar, physically located in the directory D:\myprogram\lib\ and the corresponding physical file structure is: the following command-line option is needed: or alternatively: In Java 6 and higher, one can add all jar-files in a specific directory to the classpath using wildcard notation.
The program is launched with the following command: This automatically starts org.mypackage.HelloWorld specified in class Main-Class with the arguments.