Joel Bijapurkar wrote:
We don't do
java file_system_path_to_class_file. We do
java -cp some_classpath fully.qualified.ClassName
So, if your HelloWorld class is not in a package, and you have
C:/HelloWorld.class, then you'd execute
java -cp C:/ HelloWorld
If, on the other hand, HelloWorld was in package
com.mycompany.hello, and you had, for example,
C:/projects/HW/com/mycompany/hello/HelloWorld.class, then you'd execute
java -cp C:/projects/HW com.mycompay.hello.HelloWorld
Note that the class must be in a subdirectory path matching the package name, and the parent directory of the root of that subdirectory must be on the classpath.