• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAVA_HOME variable

 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I install jdk, it automatically installs "c:\ program Files\java\jre6\bin\java"
Now I am setting environment variable Path with the value of "C:\program files\java\jre6\bin\java"
If I am setting path variable like this, do I still need to set up JAVA_HOME variable ? or if I am setting up JAVA_HOME variable as an environment variable, do I need to set up Path variable for java bin file ?
Do I setup path variable for java compiler (javac) or java executable (java) ? I was tyrying to look for javac in "c:\ program Files\java\jre6\lib\bin" , but I could not find bin folder within lib folder. javac is not within lib folder either. So where is javac located ?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49849
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It never goes into that folder when I install it on Windows. While we are at it, please read this FAQ because you have given two different locations. I suspect, if you are installing into a jre folder, that you have downloaded the wrong thing. Remember you need a JDK, not a JRE, to create Java™ programs.
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just did fresh installation for java and its installed in following dir
C:\Users\Jignesh\AppData\LocalLow\Sun\Java\jdk1.6.0_20

exe file is located in the following location
C:\Users\Jignesh\AppData\LocalLow\Sun\Java\jre1.6.0_22_x64\bin

1) This installation did not install jdk, it only installed jre1.6. Why does it not install jdk ? I did not see any option to install jdk or jre, there was only one option available.Before, there were options to install jdk or jre. Does it mean that we dont need jdk anymore ? If its required, how to install it ?
2) Where is javac located ?
3) if I have to specify JAVA_HOME, it will be JAVA_HOME=C:\Users\Jignesh\AppData\LocalLow\Sun\Java\jdk1.6.0_20. What is the need of specifying JAVA_HOME, if I am already specifying PATH and CLASSPATH ? If its not specified, does it give any issues ? Or is it only for the reference purpose ?
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not the default install folder. If you customize the folder during installation, you'd better know exactly what you're doing or you'll end up with a JRE install that overwrites the JDK install -- and no javac.exe.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49849
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Darryl Burke suggests, you have installed your JDK in an unusual location. You should add that location to your system PATH, before any other Java™ locations. This FAQ reminds you how to set your system PATH.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49849
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nirjari patel wrote:. . . Why does it not install jdk ? . . .
Did you download a JDK installer? Look here, and make sure to download a JDK.
Have you set your PATH to include that directory?
Specifying JAVA_HOME makes it easier to update PATH entries; see the FAQ I posted earlier.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic