• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tried to compile javac Zoo.java and it failed.  RSS feed

 
Don Kinney
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Attempted to compile java code using the entry c:\Users\Don\codetest >javac Zoo.java and received the response: javac is not recognized an an internal or external command, operable program or batch file. Note: I installed a JDK and updated the PATH environment variable.  Can you give me any suggestions?
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After you changed the PATH variable (assuming via GUI), did you start another command tool? Command shells that have already been started do not automatically change the PATH variable -- unless, of course, you changed it in the shell.

From the command shell, did you print out the PATH variable, to confirm that you set it correctly?

Henry
 
Don Kinney
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, using %PATH%, at the end ...C:\Program Files\java\jdk1.8.0_111\bin\javac; as I put it in the PATH variable.
 
Junilu Lacar
Sheriff
Posts: 11481
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't have javac at the end there, just ..\bin;

Elements of the PATH variable should be directories, not specific programs/commands.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also put that PATH component at the beginning of the PATH. That is in case there is an older version of the java.exe tool elsewhere. It won't like it if you compile code with a newer version of javac.

And welcome to the Ranch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!