Having trouble running the first program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Having trouble running the first program

I'm trying to get the first Hello World program to run. I've compiled the .java file and when I attempt to run the .class file I get this: "The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe". I've found this file in a different location however. Not sure what to change or how to fix the problem

23rd Aug 2016, 10:52 PM
Aleun
7 Answers
0
It seems your Java path system variable has not been set correctly. Go to chapter 3 "Installing the JDK" part 3 "JDK & PATH" and check the instructions to set the path.
23rd Aug 2016, 11:25 PM
Frostbyte
0
I double checked the location and did the test to ensure that it's working properly. I'm really not sure what it could be.
23rd Aug 2016, 11:49 PM
Aleun
0
I have cmd open to the directory that contains the class file, and then I type "java ExampleProgram".
24th Aug 2016, 12:05 AM
Aleun
0
Did you compile it before trying to run?
24th Aug 2016, 1:04 AM
Frostbyte
0
Yes, it's compiled as a .class file
24th Aug 2016, 2:19 AM
Aleun
0
What did you set as path variable?
24th Aug 2016, 10:12 AM
Frostbyte
0
Not at my computer atm, but the path leads to the jdk bin folder.
24th Aug 2016, 7:02 PM
Aleun