5

I'm trying to set the JAVA_HOME environment variable - I need to set it to the 64 bit version.

To make sure I have the 64 bit version, I checked java -version by the cmd prompt, and got the output:

Java version "1.7.0_25" 
Java<TM> SE Runtime Environment <build 1.7.0_25-b17>
Java Hotspot<TM> 64-bit Server VM <build 23.25-b01, mixed mode>

I'm assuming the last line verifies I have 64-bit... so I went to check the exact path to type into the environment variable, and found that Program Files\Java\ does not contain a jdk folder. However, Program Files (x86)\Java\ does. Instead, the former only has a jre7 folder.

I can't direct my environment variable to the 32-bit folder because Android Studio keeps telling me that I need 64-bit java. What am I missing?

(If this belongs on SuperUser and not here, just comment below and i'll delete the question here)

12
  • 1
    sounds like you don't have the jdk at all. You wouldn't, unless you downloaded it on purpose. Commented Mar 5, 2014 at 3:49
  • I have a jdk1.7.0_03 folder in Program Files (x86)\Java , and Eclipse seems to work fine. Commented Mar 5, 2014 at 3:50
  • 1
    On second read, my previous comment was too opaque. The JRE and JDK are two different things. Unless you specifically chose to download the JDK (which does come with a matching JRE) you got the JRE, which will run java apps just fine (including eclipse), but won't let you compile anything Commented Mar 5, 2014 at 3:51
  • Oh okay, I understand. What confuses me is that there is a jdk folder though. Does this still not mean that I have JDK? And if it doesn't, is it okay to install JDK without uninstalling JRE? Commented Mar 5, 2014 at 3:55
  • Does it have a javac.exe in the bin directory? If so, It's probably a JDK. Commented Mar 5, 2014 at 3:57

4 Answers 4

4

I think you are looking at JRE

type

javac -version

in your command line

Sign up to request clarification or add additional context in comments.

3 Comments

For some reason, I get the error that javac isn't a command. Does this mean I do not have JDK?
I think you installed JRE instead of JDK. Install it properly and add path in environment variables.
Okay, the command wasn't working earlier, but I edited the path and put in the bin folder, so now when I call javac -version I get the output javac 1.7.0_03
2

You can have multiple Javas installed. Sounds like you have a 32 bit JDK and a 64 bit JRE. 64 bit software is installed in the "program files" folder, and 32 bit software is installed in the "program files (x86)" folder.

a 64 bit JDK will live in /program files/java/jdkxxx

Download the 64 bit JDK installer and install it, and then point your JAVA_HOME to it.

The installer takes care of this so far as I remember, but you will want to modify your PATH variable as well to point to %JAVA_HOME%/bin; ... add that to the front of the path so that typing Java will find your JDK first.

Comments

0

your JDK will have a jre folder...set your JAVA_HOME pointing to that as that is what android studio will expect as the JAVA_HOME env

1 Comment

If I point it to Program Files\Java\jre7, Android Studio gives me an error stating 'tools.jar' seems to be not in Android Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE..
0

The problem is that during the installation (JDK download)) you probably chose like me the "x64 installer" instead of the "x64 MSI Installer" which was right under it, and it probably didnt create the required "JDK" folder so you can set the "JAVA_HOME" path correctly. In order to rectify this. go and download it and then change the environment variables for the "JAVA_HOME" to "C:\Program Files\Java\jdk-21\bin" or whatever version you are currently using and it should probably work after a restart. I hope this helped someone in 2024 because i spent a lot of time trying to figure it out myself.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.