Questions tagged [java-home]

JAVA_HOME is an environment variable which should point to the root directory of the JDK installation.

JAVA_HOME is an environment variable which indicates the directory where the Java Development Kit (JDK) software is installed.

Setting JAVA_HOME depends on the operating system:

UNIX

  • Korn and bash shells:

    export JAVA_HOME=jdk-install-dir
    
    export PATH=$JAVA_HOME/bin:$PATH
    
  • Bourne shell:

    JAVA_HOME=jdk-install-dir
    
    export JAVA_HOME
    
    PATH=$JAVA_HOME/bin:$PATH
    
    export PATH
    
  • C shell:

    setenv JAVA_HOME jdk-install-dir
    
    setenv PATH $JAVA_HOME/bin:$PATH
    
    export PATH=$JAVA_HOME/bin:$PATH
    

Windows

  1. Right click My Computer > Properties > Advanced system settings
  2. On the Advanced tab, select Environment Variables..., and then add/edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.8.0_60.

or

  1. Go to Control Panel\All Control Panel Items\User Accounts using Explorer
  2. Click on Change my environment variables
  3. Add/edit the JAVA_HOME variable to point to where the JDK software is located
613 questions
439
votes
18 answers

How to set java_home on Windows 7?

I went to the Environment Variables in 'System' in the control panel and made two new variables, one for user variables and one for system variables. Both were named JAVA_HOME and both pointing to C:\Sun\SDK\jdk\bin But for some reason, I still…
Derek
  • 4,985
  • 4
  • 20
  • 9
288
votes
25 answers

How to set JAVA_HOME in Linux for all users

I am new to Linux system and there seem to be too many Java folders. java -version gives me: java version "1.7.0_55" OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13) OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode) When I am…
Bosco
  • 3,835
  • 6
  • 25
  • 33
199
votes
12 answers

Where is the Java SDK folder in my computer? Ubuntu 12.04

I know it's installed because when I type: $java -version I get: OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-0ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode) And when I type: $locate jdk I…
Arturo
  • 3,679
  • 6
  • 34
  • 43
139
votes
9 answers

How to set Oracle's Java as the default Java in Ubuntu?

How do I change the value of JAVA_HOME in Ubuntu to point to Oracle's Java? Should it point to java-6-sun or java-6-sun-1.6.0.24 ?
Ashish Agarwal
  • 14,555
  • 31
  • 86
  • 125
138
votes
8 answers

Make $JAVA_HOME easily changable in Ubuntu

In Ubuntu, I'd like to switch my JAVA_HOME environment variable back and forth between Java 5 and 6. I open a terminal and type in the following to set the JAVA_HOME environment variable: export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun And in that…
Junho Park
  • 1,491
  • 2
  • 10
  • 11
134
votes
14 answers

How can I change Mac OS's default Java VM returned from /usr/libexec/java_home

(Wasn't sure if this should go on SU... migration is certainly an option, but more programmers read questions here, so here goes). I am running Mac OS X 10.8.4, and I have Apple's JDK 1.6.0_51 installed as well as Oracle's JDK 1.7.0_25. I recently…
Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77
133
votes
8 answers

Should JAVA_HOME point to JDK or JRE?

I pointed the JAVA_HOME to C:\Program Files (x86)\Java\jre7. It works fine. Afterwards, I unzipped ant and set up the environment variables related to Ant, I got the following error messages after typing "ant -version" I searched this forum. Looks…
user297850
  • 7,705
  • 17
  • 54
  • 76
126
votes
10 answers

Using JDK that is bundled inside Android Studio as JAVA_HOME on Mac

I tried to open Android Device Monitor and the Studio showed me this message =-O : It surprised me, because how have I been able to develop Android apps if I didn't have any Java installed?! Actually, Android Studio comes with bundled JDK/JRE…
soshial
  • 5,906
  • 6
  • 32
  • 40
120
votes
18 answers

Set ANDROID_HOME environment variable in mac

I am new in developing native app using Salesforce SDK. I tried to create android project from command line using forcedroid tool but there is problem in setting environment variable named ANDROID_HOME. But i don't know how to set this variable. I…
dharmendra vaishnav
  • 1,851
  • 2
  • 17
  • 23
116
votes
22 answers

How to set JAVA_HOME in Mac permanently?

I am trying to set JAVA_HOME by entering export JAVA_HOME=/Library/Java/Home at terminal. It sets the JAVA_HOME for current session. How can I set it permanently?
Vishal Tavande
  • 1,299
  • 2
  • 9
  • 8
111
votes
8 answers

what is the reason for the existence of the JAVA_HOME environment variable?

Many java based application requires to set JAVA_HOME env variable. What's the purpose of this variable?
user496949
  • 83,087
  • 147
  • 309
  • 426
96
votes
15 answers

What is the correct target for the JAVA_HOME environment variable for a Linux OpenJDK Debian-based distribution?

In Windows, JAVA_HOME must point to the JDK installation folder (so that JAVA_HOME/bin contains all executables and JAVA_HOME/libs contains all default jar libraries). If I download Sun's JDK bundle and installs it in Linux, it is the same…
Luis Soeiro
  • 4,262
  • 6
  • 35
  • 45
80
votes
16 answers

Error: JAVA_HOME is not defined correctly executing maven

I installed java and set the path environment and when I run echo $JAVA_HOME in the terminal I get the following output: /usr/lib/jvm/java-7-oracle/jre/bin/java I Also installed apache-maven and changed environment file and now it looks like…
user3127896
  • 6,323
  • 15
  • 39
  • 65
67
votes
18 answers

Installing Android Studio, does not point to a valid JVM installation error

I just downloaded the Android Studio. While trying to run it, I had to modify the environment variable and add JAVA_HOME and C:\Progra~2\Java\jdk1.6.0_22 Once I finished that hurdle, now I am receiving another error: The environment variable…
LegionDev
  • 1,391
  • 4
  • 15
  • 29
63
votes
8 answers

How to change Java version used by TOMCAT?

I have Java 1.6 and Tomcat 5.5 installed on my system. But Tomcat 5.5 accesses Java 1.5 and hence as the outcome I get the error Bad version number in .class file while executing java code with JSP. How can I change the Tomcat version to Java…
LGAP
  • 2,365
  • 17
  • 50
  • 71
1
2 3
40 41