r/javahelp • • Apr 02 '16

help?

I am new trying to learn java programming i started watching "thenew****" Tutorials, everything was fine untill i reached the second video where i reach the command prompt part to load my code. When i want to put ex " java Hello.java" It says Error: Could not find or load main class. DOnt even know if i have the right java or version anyway this is it . jre1.8.0_45 . Hope i get helped.

0 Upvotes

13 comments sorted by

View all comments

1

u/Rainbow_Rage Apr 03 '16

You need to use ´javac Hello.java´ to compile your code. Then you need to use ´java Hello´ to run it.

If you used a package, you need to use the full name of your class including the package with the Java command. So it would be ´java com.package.Hello´. The command also needs to be run from the root source directory, not the directory with the. Class file