Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Installing Java Problem

 
Willem Krayenhoff
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was following http://www.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]
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • 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: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
It's working now - thank you very much! Seems obvious now, but I wasn't seeing it before.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic