• 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

JAVA_HOME variable

 
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic