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

16th Jan 2017, 10:20 PM
Cole McCoy
Cole McCoy - avatar
16 Respuestas
+ 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
16th Jan 2017, 10:56 PM
seamiki
seamiki - avatar
+ 2
try removing "c:\" before the file path
16th Jan 2017, 11:12 PM
seamiki
seamiki - avatar
+ 1
try following commands and tell us the result : java -version javac -version
16th Jan 2017, 10:24 PM
Andreas K
Andreas K - avatar
+ 1
ok that's good. what is your exact issue?
16th Jan 2017, 10:35 PM
Andreas K
Andreas K - avatar
+ 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
16th Jan 2017, 10:39 PM
Andreas K
Andreas K - avatar
+ 1
cd <path> replace <path> with your folder path
16th Jan 2017, 10:44 PM
Andreas K
Andreas K - avatar
+ 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
16th Jan 2017, 10:47 PM
seamiki
seamiki - avatar
+ 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
16th Jan 2017, 10:49 PM
Andreas K
Andreas K - avatar
+ 1
TRY THIS COMMAND C:\Program Files\Java\jdk1.8.0_111\bin\javac Users\sloving\Documents\java projects\ExampleProgram.java
16th Jan 2017, 10:58 PM
seamiki
seamiki - avatar
+ 1
javac is not the issue thats why I told him to test javac -version
16th Jan 2017, 10:59 PM
Andreas K
Andreas K - avatar
0
javac 1.8.0_111 java 1.8.0_111 java 1.8.0_111-b14
16th Jan 2017, 10:36 PM
Cole McCoy
Cole McCoy - avatar
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
16th Jan 2017, 10:39 PM
Cole McCoy
Cole McCoy - avatar
0
hmmm no i'm not how do i change the directory?
16th Jan 2017, 10:43 PM
Cole McCoy
Cole McCoy - avatar
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
16th Jan 2017, 10:56 PM
Cole McCoy
Cole McCoy - avatar
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
16th Jan 2017, 11:09 PM
Cole McCoy
Cole McCoy - avatar
0
I figured it out thanks everyone!
16th Jan 2017, 11:32 PM
Cole McCoy
Cole McCoy - avatar