Problem With Hello World in JAva | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Problem With Hello World in JAva

Getting the error: Error: Could not find or load main class HelloWorld Caused by: java.lang.ClassNotFoundException: HelloWorld It happens only in pc https://code.sololearn.com/coI0JaRaE3ru/#java

18th Jun 2020, 4:54 PM
Kalpak Baul
Kalpak Baul - avatar
3 Answers
+ 2
Maybe you need to rename the class HelloWorld to Main.
18th Jun 2020, 5:09 PM
Seb TheS
Seb TheS - avatar
+ 1
Kalpak Baul Your file name should same as class name like HelloWorld.java or maybe your java classpath is not proper in your environmental variable. If you are getting problem in eclipse then you can check this link https://www.java67.com/2016/09/3-ways-to-solve-eclipse-main-class-not-found-error-java.html?m=1
18th Jun 2020, 5:24 PM
A͢J
A͢J - avatar
0
Yes, happens if you didn't run the code properly. Can you please tell what are the steps you follow to run this code on your PC
18th Jun 2020, 5:07 PM
Seniru
Seniru - avatar