How can we remove" could not load main class " error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

How can we remove" could not load main class " error?

1st Apr 2018, 6:10 AM
vaishnavi
2 Answers
0
While executing, when JVM does not find a .class file with the specified name then a run time error occurs saying “Could not found or load main class”. The reason why this happens is mostly due to: Wrong Class Name Invalid Classpath Main class could not be found when there is typo or wrong syntax in the fully qualified java class name or it does not exist in the provided classpath. You must ensure that you add the location of your .class file to your classpath. So, if its in the current folder, add . to your classpath. Note that the Windows classpath separator is a semi-colon( ;) . If you want to execute the main() method in MainClass, you must use the full class name, including package name, in the java command. http://net-informations.com/java/cjava/default.htm
16th Sep 2020, 5:51 AM
geraldwarp