Latest web development tutorials

Java example - how to perform the specified class file directory (classpath)

Java Examples Java Examples

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

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

The above command we use -classpath parameter specifies the directory where the HelloWorld class file.

If the class file in a jar file, the command is as follows:

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

Java Examples Java Examples