0
javac issues
So i tried to run a program with hello world my java path directory is C:\Program Files\Java\jdk1.8.0_111\bin and i used not pad plus to make the file and it's currently in my documents the file is named ExampleProgram.java
16 odpowiedzi
+ 3
Right shorter answer:
use the javac path for the javac command and the file path fot the file you want to compile.
Example as a reference (the path to your file may be different)
C:\Program Files\Java\jdk1.8.0_111\bin\javac users\yourUserName\mydocuments\ExampleProgram.java
+ 2
try removing "c:\" before the file path
+ 1
try following commands and tell us the result :
java -version
javac -version
+ 1
ok that's good. what is your exact issue?
+ 1
Are you in the correct folder with the command prompt. This can be identified by the path that is written in the line you enter your command
+ 1
cd <path>
replace <path> with your folder path
+ 1
You must set the JAVA PATH so that commands as "javac" will be recognized as system commands.
if you don't set the java path you have to write the whole path before javac in order to run the command.
info on how to set java path here:
https://www.google.com/url?q=https://www.java.com/en/download/help/path.xml&sa=U&ved=0ahUKEwjp4bLp3sfRAhUSSI8KHRYgCa8QFggPMAE&usg=AFQjCNFMtoatLS-nLSsucXec0BU9IRr5tg
+ 1
seamiki you are completely wrong. It's a completly other issue. Please read previous answers before. Sorry if you wrote that long without updating the thread
+ 1
TRY THIS COMMAND
C:\Program Files\Java\jdk1.8.0_111\bin\javac Users\sloving\Documents\java projects\ExampleProgram.java
+ 1
javac is not the issue thats why I told him to test javac -version
0
javac 1.8.0_111
java 1.8.0_111
java 1.8.0_111-b14
0
i'm trying to run the exampleprogram and no matter what way i create it i can't seem to get it to work. it says file not found everytime
0
hmmm no i'm not how do i change the directory?
0
OK so here was I've done the path for jdk is C:\Program Files\Java\jdk1.8.0_111\bin
it would not recognize javac unless i specified the exact folder it was in i could not do C:\Program Files\Java\jdk1.8.0_11. i want javac to open a file from my documents which contains everything im going to do with java is C:\Users\sloving\Documents\java projects
0
just in case it's already not apparent im new to this..i tried javac\-pC:\Program Files\Java\jdk1.8.0_111\bin\javac C:\Users\sloving\Documents\java projects\ExampleProgram.java
0
I figured it out thanks everyone!