• 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

Installing Java Problem

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I was following https://coderanch.com/how-to/java/how-to-create-java-program#SettingJavahomeAndPath

I got to this part:

Checking that your JDK is configured properly

Open the command prompt, go to a directory different from your JDK install directory, and type "javac -version". This should display the version of your SDK. Make sure it is correct. If an error like "Command not found" is displayed, make sure you have correctly set your PATH.



It says that 'javac is not recognized as an internal or external command, operable program or batch file.'

I have attached screen clippings of the directory structure and how I configured the path and JAVA_HOME variables.

thanks for your help!

Java-Directory-Structure.PNG
[Thumbnail for Java-Directory-Structure.PNG]
Path-and-JAVA_HOME.PNG
[Thumbnail for Path-and-JAVA_HOME.PNG]
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your JAVA_HOME is pointing to C:\Program Files\Java\jre7\. A JRE is the runtime only, and doesn't have the compiler. You need to either specifically add C:\Program Files\Java\jdk1.7.0_05\bin to the PATH variable, or you need to change JAVA_HOME to C:\Program Files\Java\jdk1.7.0_05.

Then make sure you close the command prompt and re-open it.
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Luke wrote:or you need to change JAVA_HOME to C:\Program Files\Java\jdk1.7.0_05.


That's the only proper solution. JAVA_HOME should never point to a JRE.
 
Willem Krayenhoff
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's working now - thank you very much! Seems obvious now, but I wasn't seeing it before.
 
Ranch Hand
Posts: 859
IBM DB2 Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And you should never install to "Program Files"!!

The space there causes all sorts of grief unless JAVA_HOME is in quotes.

WP
 
reply
    Bookmark Topic Watch Topic
  • New Topic