Java solution for – Error: Could not find or load main class

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

For example java package mypkg1 contains the main but I am still getting the error
Error: Could not find or load main class One
Full example below.

mypkg1/One.java

Two.java

After compiling with javac.
pwd
/tmp/my_program
Now lets run the program, all works

But if the same is run from /


The solution is to simply define the CLASSPATH, or specify on the commend line

Leave a Reply

avatar
300
  Subscribe  
Notify of