Unable to properly install Eclipse in Mac OS X Mavericks - java

I'm now at my wit's end with this and really struggling.
I've installed both JDK 7.0 and 8.0, I've tried both 32bit and 64bit versions of the Eclipse software and I've installed Java 1.6 from the Apple website. I've also restarted my machine and tried this whole process on a new user on my laptop.
Before I did some of this I was getting the error message 13 which I discovered was to do with some sort of incompatibility. It was asking me to install JVM 1.6 which I think I did.
I'm now getting a message that "Eclipse has unexpectedly had to quit" every time I've opened it.
I've been looking at this blog came up and when I looked I didn't have the JavaVM.Framework folder.

If you have multiple JREs installed, Eclipse could be picking up an incompatible one. First, ensure that you match 32-bit/64-bit of Eclipse and the JRE you want to use. If one is 32-bit and the other is 64-bit, Eclipse will not start. Next, edit your eclipse.ini file and add the following two lines at the very beginning of the file to force Eclipse to use a particular JRE.
-vm
[full-path-to-JRE's-bin-folder-or-java-executable]

Open a terminal window and execute this command:
$ /usr/libexec/java_home -V
This should return a list of all the installed version of Java, something along the lines of:
1.7.0_67, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
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
Then to set your JAVA_HOME run this command (obviously set it to the version you want to use):
$ /usr/libexec/java_home -v 1.7

Related

Can't install Java 1.8 on my mac

so here is my problem :
I wanted to install Eclipse on my Macbook Pro to code in Java. However when I launch the Eclipse Install I have a popup saying :
Version 1.6.0_65 of the JVM is not suitable for this product.Version: 1.8 or greater is required.
So I went on the java website to install the latest version of java, which is the version 8 update 121. Then I got a dmg file and started installing it. Everything worked fine and the installation finished. I tried to restart the Eclipse Install but the same popup still showed up. I went to the System Preferences in the Java section and it says that I have the latest version installed, which is 8 update 121.
After searching a little on the internet, I checked the version in the Command Line :
$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
Apparently I have to tell java_home to use the last version with the command :
$ /usr/libexec/java_home -v jdk1.8.0_121 --exec javac -version
However I get :
Unable to find any JVMs matching version "jdk1.8.0_121".
So I also checked which versions I had :
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
1.6.0_65-b14-468, x86_64: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
As you can see the version 1.8.0 is not here.
I tried to look into the file directory to find the folder in /library/Java/JavaVirtualMachines, but there is only the folder "1.6.0 jdk".
So my question is where is Java ? Why does the System Preferences say I'm at 1.8 and the Command Line says 1.6 ? How do I install it properly in order to install Eclipse ?
If it helps I have a Macbook Pro 2012 on macOS Sierre 10.12.2
Thanks
You have almost certainly only installed the Java 8 JRE. On macOS this only installs Java plug-ins support in the browser. To get full Java 8 support you must install the full JDK ('jdk-8u121-macosx-x64.dmg' is the current version of the JDK).
First do a clean install of java by following the below steps for uninstalling and re installing java.
To do clean uninstall:
1. Click on the Finder icon located in your dock
2. Click on the Utilities folder
3. Double-click on the Terminal icon
4. In the Terminal window Copy and Paste the commands below:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java
Then do a reinstallation of java 8 by using the link,
https://www.java.com/en/download/help/mac_install.xml

MacOS JDK path. Where is it? [duplicate]

This question already has answers here:
Setting Java home enviroment variable in OSX Mavericks
(2 answers)
Closed 7 years ago.
I recently started using MacOS and I think that my IDE is not finding the proper JDK path. Here's what I've done.
Initially when I got my Mac I installed the JDK from Apple's website (I thought it would just work if I got that version). It seemed like it worked until I tried importing a project into Eclipse and it said JDK 7 was requires (the version from Apple is only version 6).
I then downloaded JDK 8 from Oracle and installed. I know that after this step I having to do this. However I am not sure where this new install is located (for whatever reason, when this program installs it doesn't show any sort of directory so I have no idea where it went).
Searching "jdk" for the install directory I have found:
It's not in applications (which makes sense, but that's where
everything else goes that I have installed).
I tried searching Macintosh HD and I don't see anything (I feel like something went wrong here because why wouldn't this work?). Is Macintosh HD the closest-to-root directory on MacOS?
To find the current home of the JDK on MacOS, type this in Terminal:
/usr/libexec/java_home
On my machine, this yields:
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
but note that your version is probably different, so run the command, don't copy-paste the result.
To find all existing JDKs, including previous versions:
/usr/libexec/java_home -V
On my machine this yields:
1.8.0_40, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
1.7.0_71, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
1.7.0_67, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
Now, make sure your Eclipse sees at least one of these. Open its preferences:
If your JRE does not appear there, add it. If it does, go to your project's build path and make sure it appears there as well. In Project→Properties, you are supposed to see:
The current update 45 of the Java 8 JDK installs in to
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home

Uninstalling JDK 8 on OSX

How can I cleanse my Mac of Java 8 -- jdk, not jre or plugin, which I don't care about? I need to downgrade to jdk 7. I've found docs online but they're all about the java plugin. If I try simply installing jdk 7 (on top of 8), the 8 is still there.
You can uninstall a JDK simply by deleting the appropriate directory under /Library/Java/JavaVirtualMachines where it is installed. But note that browsers, Java Web Start and double-clickable app bundles created with Oracle's appbundler will always use the "public JRE" under /Library/Internet Plug-Ins, and that will remain as Java 8 unless you uninstall it separately.
But you may not actually need to uninstall Java 8 - the command line tools such as java and javac respect JAVA_HOME, so you can have both versions installed side by side and pick the appropriate one with /usr/libexec/java_home:
export JAVA_HOME=`/usr/libexec/java_home -v '1.7*'`
On my machine, I get the following output from terminal:
> /usr/libexec/java_home -v 1.6
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> /usr/libexec/java_home -v 1.7
/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
> /usr/libexec/java_home -v 1.8
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
Check yours and let me know.

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.

Eclipse on Mac 10.8 - Installed 1.7.0 JRE / JDK, but Eclipse won't launch

Installed Java SE 1.7.0u10 from Oracle w/ their installer package
Downloaded and unpacked Eclipse Juno (4.2.1)
Double click Eclipse purple icon and get OS X alert prompt with error message:
To open "Eclipse," you need a Java SE 6 runtime. Would you like to
install one now?
(in terminal) which java - /usr/bin/java
ls -l /usr/bin/java - /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
(in Finder) Double click eclipse alias (included when unpacked download) - Terminal launches, /Applications/Eclipse/Eclipse.app/Contents/MacOS/eclipse ; exit ; and Exclipse launches without OS X alert prompt.
I've tried modifying the Eclipse app bundle plist to point the -vm key to /System/Library/Frameworks/JavaVM.frameworks/Versions/Current/Commands/java, but I feel like I probably shouldn't have to do this.`
I'd like to know how to get Eclipse to launch by just double clicking on the Application package. It's such a small thing to bug me... :o)
The best answer is to fix the Java 7 installation as shown here :
https://stackoverflow.com/a/19594116
Simple to do and I have confirmed it works on Mavericks. With this fix, you can launch your app from the launchpad as usual. If you upgrade your JDK, you will have to reapply the fix to the new installation.
I had JDK 7 installed and I solved this issue for eclipse Kepler by running eclipse from the terminal instead of the finder.
./eclipse
Just thought to share.
Update 1
For the sake of completeness, if you want to run it from Finder as well, you can wrap the ./eclipse command into a .command file and run it from Finder (so that you don't have to open a terminal)
The following lines should do the job (don't forget to replace "your-full-eclipse-path" with the eclipse path on your machine)
#!/bin/sh
/your-full-eclipse-path/eclipse
After that, give execute permission to the eclipse.command file you just created
chmod +x eclipse.command
I found the answer over on Ask Different
It's an ugly hack, but works perfectly.
posted on this page: Mountain Lion with Java 7 only
To trick OS X to accept Java 7 instead of proposing to install Java 6 a simple symlink is enough:
sudo mkdir /System/Library/Java/JavaVirtualMachines
sudo ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
Most Java Programs will run with this little hack without the need to install Java 6. OS X's Java Preferences (and maybe some others) will not as it seems to explicitly check the version of the JVM when it is started.
script above can fix my problem.
Hoping you are using 64-bit of Java SE 1.7.0 and so advising the following.
go to Eclipse->Preferences...->Java->Installed JREs
click Add...
Select Standard VM
paste /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home into JRE home
Change the JRE name to something useful like Java SE 7
Click Finish
Check the check-box next to your newly created JRE.
You would need a restart.
For what it's worth, the Eclipse team seems to have worked around it by replacing their dlopen()-based method with a CFBundleCreate()-based one: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361
In case anybody has the same problem in their code that launches Java and does not want to resort to Apple-only APIs, I found an easier work-around: before dlopen()ing $JRE_HOME/lib/server/libjvm.dylib, make sure to open dlopen() $JRE_HOME/lib/jli/libjli.dylib. Then it won't ask to install Java 6.
Can you imagine that? You have to install a JDK 1.6 to get eclipse ran properly, even if you already have jdk 1.7 installed, and set the JAVA_HOME properly.
To resolve your issue, you just need to download the jdk1.6 from http://support.apple.com/kb/DL1572?viewlocale=en_US, and install it, later you will be able to run eclipse, and you can set the JAVA_HOME to JDK1.7, and you will be able to find the JDK1.7 from eclipse "Preferences".
All these hacks does not work on mac Mavericks,
But a simple and efficient solution is found here
it worked with me like a charm.
Note: a drawback of this solution is when you check your java version using "java -version" command, it will read Java 1.6
open /Library/Java/JavaVirtualMachines/jdkXXXXX.jdk/Contents/Info.plist
settting(<string>BundledApp</string> is usefull!):
<key>JVMCapabilities</key>
<array>
  <string>JNI</string>
  <string>BundledApp</string>
  <string>WebStart</string>
  <string>Applets</string>
  <string>CommandLine</string>
</array>
I had the exact same message when setting up a new mac and trying to run eclipse 4.2.2 with only Java SE 7 installed (as part of JDK 7u17).
In order to be able to successfully launch Eclipse I had to let OSX download and install Apple's Java SE 6 runtime first before installing the latest JDK.
After installing the JDK, the command java -version correctly shows:
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Trying to solve the problem the other way around didn't work -- i.e. installing JDK 7u17 first before installing Java SE 6 as suggested in the message.
I had the exactly same problem some days ago and I solved it today. Just installed this http://support.apple.com/kb/dl1572
And after that, when I opened the eclipse the OSX installed some java update and opening eclipse by Eclipse.app started working.
Hope it works with you too.
If you'd like to install Java 6 JDK only (no Java 7 JDK/JRE, no Java 6 JRE only), install the Apple OSX Java DMG (at time of writing, this was http://adcdownload.apple.com/Developer_Tools/java_for_os_x_2013003_developer_package/java_for_os_x_2013003_dp__11m4406.dmg).
You still won't be able to start Eclipse. Make a directory JavaVirtualMachines under /System/Library/Java. And then make an Alias of the java version folder at /Library/Java/JavaVirtualMachines and rename the alias 1.6.0.jdk and copy that alias to /System/Library/Java/JavaVirtualMachines/
After finished, you will have an Alias at /System/Library/Java/JavaVirtualMachines/1.6.0.jdk that points to the Java install directory at */Library/Java/JavaVirtualMachines/1.6.0_XX-XXX-XXX.jdk*
Install latest JDK from Sun, it installs into /Library/Java/JavaVirtualMachines/, e.g. /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk
sudo mkdir /System/Library/Java/JavaVirtualMachines
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/ /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
========= this trick used to work on Mountain Lion, but not on Maverick 10.9 somehow ============
Tried this again on Maverick, it does not work anymore. I also tried to change eclipse app plist and eclipse.ini (by adding -vm or ), does not work either.
Some people suggested that this is caused by Eclipse binary prepared using Apple 1.6 appbundler instead of Oracle java7 appbundler: Application is using Java 6 from Apple instead of Java 7 from Oracle on Mac OS X?
For now, please just type the eclipse from command line, which works fine with JAVA_HOME set to Java 7 (/usr/libexec/java_home command will tell you)
How to Make Eclipse Run on OS X 10.9 Mavericks
Attempting to launch various Eclipse versions after the Mavericks upgrade pops up a dialog with this message:
To open "Eclipse.app" you need a Java SE 6 runtime. Would you like to install one now?
It turns out that Java 7 is disabled by default in OS X 10.9.
This is easily verified as follows:
$ java --version
No Java runtime present, requesting install.
The solution is to install the latest supported Java version from Apple support: Java for OS X 2013-005 (http://support.apple.com/kb/DL1572)
As of 10/15/13 this would be Java SE 6 1.6.0_65.
Post Date: Oct 15, 2013
File Size: 63.98 MB
After the install, Eclipse will run as expected from the Dock, the Finder, or the Terminal without any tricks, hacks, or work-arounds.
I wanted to run Eclipse itself with Java 7. As I have a couple of plugins that do not work without it. For me neither solution worked for 10.9, but I found a workaround. The main idea is that you start eclipse with java -jar launcher.jar and provide a couple of magic properties and then it starts. This guy provided the command line script in comments that works for me:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361#c25
I found the same problem (Mac OS X 10.9.2, Java 1.7.0_53b13, Eclipse Kepler). The workaround was quite easy:
Find the executable in Finder (CMD+Click on Eclipse's icon in the Dock)
Remove the icon from the Dock
CTRL+Click on the executable in Finder
ALT+Open (to allow the execution of a non-signed application)
Eclipse opens normally and without any problem
Re-dragged the program onto the Dock
I had this problem and found that I did not have JDK installed on my Mac. Once I did that, Eclipse starts normally.
I had same problem.
First of all ; JDK(java development Kit) and JRE(Java Runtime Environment) are different things. It was confused by people
In order to install eclipse yo should install latest JDK . So
Visit
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Download suitable version for your mac
You can check your version now ; it won't be 1.6 anymore
Try to install eclipse again , see it works.
Good luck!..

Categories