aspose file tools*
The moose likes Beginning Java and the fly likes JAVA_HOME variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JAVA_HOME variable" Watch "JAVA_HOME variable" New topic
Author

JAVA_HOME variable

nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 374
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

Joined: Oct 13, 2005
Posts: 39409
    
  28
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

Joined: Apr 23, 2009
Posts: 374
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

Joined: May 03, 2008
Posts: 4642
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
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

Joined: Oct 13, 2005
Posts: 39409
    
  28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAVA_HOME variable