简体   繁体   中英

JDK and JREs installed, but Eclipse Juno with ADT can't find them on Mac OS Mavericks

Eclipse ADT was working until update of Eclipse to the next version Juno with ADT.

Now, Eclipse can not find any installed JREs. I have followed several difference restoration methods on StackOverFlow, SOF, which included reinstalling JDK...I used Apple support KB download [ http://support.apple.com/kb/DL1572?viewlocale=en_US ] to update existing JDK 6...

As diagnostic, ran the following so I know that the JREs are there..

$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.6.0_65-b14-466.1, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_65-b14-466.1, i386:   "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
$ which java
/usr/bin/java

I researched SOF [ Installing Java on OS X 10.9 (Mavericks) ] several posting suggest, using:

$  export JAVA_HOME="/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"

Then add that to your PATH:

$  export PATH=$JAVA_HOME/bin:$PATH

I have tried several methods posted on StackOverFlow without success. I have not tried the above, because I do not understand how it works. If you have a better suggestion or can explain how "exporting" the Java Home would solve the issue, please POST.

First, your side question about exporting.

Exporting an environment variable marks it so that all child processes will inherit that variable. In your situation, first exporting the JAVA_HOME and PATH variables and then executing Eclipse in the same, or child, shell would make it possible for Eclipse to use those values.

An alternative, and better way is to modify the eclipse.ini file to point to the JVM you would like it to use. http://wiki.eclipse.org/Eclipse.ini describes how to accomplish the task.

Both of the above items are about the JVM that Eclipse is going to run on. If your problem is really about the JRE that Eclipse is using to compile/run your code then setting that would be handled using Eclipse settings. Once in Eclipse, choose Window -> Preferences from the menu. In the preferences window open the Java item then choose Installed JREs. You can add or edit the JREs (or JDKs) that Eclipse will use here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM