0

I'm running into an issue where I am able to compile Java files but I cannot run any of them. I have currently created a Hello World java file in my Desktop folder and compiled it and there is a HelloWorld.class that has been created as well. But when I run java HelloWorld, I get the following error:

Error: Could not find or load main class HelloWorld Caused by: java.lang.ClassNotFoundException: HelloWorld

I have googled around and it seems to have something to do with CLASSPATH? I have tried the command ECHO ${CLASSPATH} and it has returned me nothing but apparently it should return me . ? Could someone point me in the direction of how to fix this java issue and does it have anything to do with CLASSPATH? Thank you!

  • @AlexandervanOostenrijk I'm not sure, because I don't even know if the error is due to the classpath! My java files were compiling and running normally a few months ago so I'm not sure what's changed – user23534757 Aug 17 '21 at 10:50
  • @user23534757 can you provide the code which you trying to compile. – Bhavin Aug 17 '21 at 11:07
  • @Bhavin Hi Bhavin, it's a simple Hello World print statement in a file called HelloWorld.java – user23534757 Aug 17 '21 at 12:04

0 Answers0