Easy Tutorial
❮ Data Insert Java String Getbytes ❯

Java Example - How to Execute a Specific Class File Directory (Classpath)

Java Examples

If the compiled Java class files are not in the current directory, we can use the -classpath option to specify the class file directory:

C:> java -classpath C:\java\DemoClasses HelloWorld

In the above command, we used the -classpath parameter to specify the directory where the HelloWorld class file is located.

If the class files are in a JAR file, the command would be as follows:

c:> java -classpath C:\java\myclasses.jar

Java Examples

❮ Data Insert Java String Getbytes ❯