• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javac is still not recognized; Tried everything

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a complete beginner in Java, and everything related to IT, but i decided to learn Java with Headfirst Java.
I have a Windows 10, download Java jdk1.8.0_60 and the API documentation. When i type in the command prompt: javac HelloWorld.java, the answer is: javac is not recognized as an internal or external command, operable program or batch file. I've set the path in the environmental variables like this:C:\Program Files\Java\jdk1.8.0_60\%JAVA_HOME%\bin\javac.exe. Didn't help. How do I solve this problem?
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

All you need in the PATH variable is C:\Program Files\Java\jdk1.8.0_60\bin. This tells Windows where to find javac.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Also, it may be a good idea to *not* delete your previous PATH -- meaning that the java bin directory should be added to the path, and not replace the path.

Henry
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:All you need in the PATH variable is C:\Program Files\Java\jdk1.8.0_60\bin. This tells Windows where to find javac.


all you need to ADD to the path is this...by all means do NOT REPLACE everything there with just this.
 
Bartender
Posts: 2236
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And after you change the variable you need to reopen or reload the console (by typing cmd).
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Close cmd, and launch it again.

Make sure you have set the environment variables correctly

Add a user variable 'with
Variable Name:- JAVA_HOME
Variable Value :- C:\Program Files\Java\jdk1.8.0_20

and go to path system variable and add this line to the front(%JAVA_HOME%\bin;)
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry guys; my post was poorly worded. To be specific, if your PATH variable looks like this:

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

...then add the Java bin to the end, like this:

C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.8.0_60\bin

Notice the semicolon (;) between the old end of the PATH and the new entry.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote: . . .
...then add the Java bin to the end, like this:
. . .

Actually it is often better to add the Java path to the beginning of the PATH. If the rest of the PATH contains a java tool which is older than the javac tool in JDK1.8.0_60, you will get problems when you try to run it.
 
Nick Woods
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you guys for the answers. As Campbell Ritchie said, i just needed to add the java part in the beginning and then problem solved
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome

Actually Karan Pant said to add it at the beginning before I did.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic