I compile my file with javac myfile.java
But when I run myfile.class file with command : java myfile I get an ClassNotFound error. My Java version is openjdk-6
I compile my file with javac myfile.java But when I run myfile.class file with
Share
Run the command as this (in the same directory where you compiled):
java -cp . myfileAssuming of course that the file contains a class called
myfile, which btw, doesn’t follow standard Java naming practices (should begin with a capital letter).Read up on here more about setting your runtime classpath.