Mac OS X Java Update: where is my jdk? - eclipse

I've installed on my iMac (Mac OS X 10.6.6) the Java update which contains the version 1.6.0_24 of the jdk. I think this update has changed the directory structure of the jdk, so now I'm not able to configure it on eclipse.
Before the update my eclipse were linked to this path: /System/Library/Frameworks/JavaVM.Framework/Versions/Current/Home which actually seems wrong.
Now I'm not able to link my eclipse to the jdk. Maybe this is the right path: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home, but 1.6.0.jdk isn't a directory, so I'm not able to choose it in eclipse.
Has anyone experienced this problem? How can I solve it?

For me following jdk link is working fine on Eclipse:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

It was my fault. I had also a jdk 1.5 manually installed and the update moved it away.
Probably I made a mistake restoring my jdk-1.5 to its correct location.
To solve my issue I just had to restore the symbolic links /System/Library/Frameworks/JavaVM.Framework/Versions/CurrentJDK, which has to point to /System/Library/Frameworks/JavaVM.Framework/Version.

the follow directory works:
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
without "System"

Execute /usr/libexec/java_home on the terminal shell.
It will display a list of all your installed JDKs

On MacOSX 10.10, jdk 1.8 with IntelliJ, I use:
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/

I was missing CurrentJDK folder as well, but I'm running Mac OS El Capitan.
In El Capitan it's not possible to modify the folder /System/Library/Frameworks/JavaVM.framework/Versions, since it is under the /System folder and SIP is protecting it (you can disable SIP, but I do not recommend), a custom CurrentJDK soft link is not allowed.
I got some legacy software which was searching for CurrentJDK, and there was no way to update the path. To solve it I had to install Java for OS X 2015-001 provided by apple (it's Java 1.6), which fixed the Versions subfolder structure by pointing to the old Java 1.6. Not the best, but it fixed my error!

Related

Not able to run Eclipse on macOS Big Sur

I am not able to run eclipse on macOS Big Sur developers beta I am getting an error stating "Failed to create the java virtual machine". Is there any way to solve the error
The java version I am running:
I have the same issue. I solve it by opening /Applications/Eclipse.app/Contents/Info.plist and adding:
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java</string>
inside
<key>Eclipse</key>
<array>
ADD HERE!
</array>
Of course the "/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java" value must be replaced with the actual path based on the JDK version you are using.
TL;DR
Use this to export JAVA_HOME variable:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home
Long Version
This answer is wrt to BigSur v11.0.1 Beta. What I explored is if you have configured your .bash_profile JAVA_HOME export something like this
export JAVA_HOME=$(/usr/libexec/java_home)
Then it case it was trying to importing this, for some reason
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
rather than
/Library/Java/JavaVirtualMachines/**/Contents/Home
For the quick fix, I configured my JAVA_HOME like this
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home
If you are switching between multiple JVMs at once then you may find this .bashrc/.zshrc configuration handy
export JAVA_8_HOME="jdk1.8.0_231.jdk"
export JAVA_11_HOME="openjdk-11.0.2.jdk"
export JAVA_13_HOME="jdk-13.0.1.jdk"
alias java8='export JAVA_HOME="/Library/Java/JavaVirtualMachines/$JAVA_8_HOME/Contents/Home"'
alias java11='export JAVA_HOME="/Library/Java/JavaVirtualMachines/$JAVA_11_HOME/Contents/Home"'
alias java13='export JAVA_HOME="/Library/Java/JavaVirtualMachines/$JAVA_13_HOME/Contents/Home"'
# default to Java 8
java8
Edit the Info.plist to set the -vm value.
Install the latest Eclipse version, I am using version 2020-06
Right-click on Eclipse.app
Show Package Contents
Open Info.plist with a text editor
Add -vm/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/java under the under the key Eclipse. Note - edit the path to Java depending on what version you have. You can see the list by running /usr/libexec/java_home -V
To fix this issue I deleted the openJDK VM and reinstalled it
Delete the openJDK folder from
/Library/Java/JavaVirtualMachines
Reinstall openJDK from here
Open applications and right-click spring suite > Show Package Contents
Edit file Contents/info.plist. Add this
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home/bin/java</string>
This should be inside the array tag inside eclipse key
I solved this by using Homebrew
brew cask install eclipse-java
Same thing happened to me turns out when I ran echo $JAVA_HOME the directory has been replaced,
Doing a brand new export to the java home file seemed to do the trick,
I used
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/
Seemed to do the trick, note that your directory might be different I suggest tracing to your correct directory by using "/" then tab to trace the directories.
In my case I'm using a old version IDE and it's dead, already add the JAVA_HOME variable, ini and list of eclipse and not working, also noticed virtualbox is dead also can start any VM.
-vm/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/bin/java
Confirmed, adding below to Infolplist worked. I have Oracle jdk 8 and updated the value below.
-vm/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/bin/java
I tried all solutions posted under this question; but none of them worked for me. Finally, I installed the latest version of Eclipse 2020-09 (4.17.0) to make it work.
I upgraded to Big Sur a few days ago and also encountered this problem when I finally ran Eclipse this morning.
The latest Eclipse 2020-12 release includes its own JRE (!), thus I no longer experience "Failed to create the java virtual machine". I've left my Java versions unchanged for now as I only use Eclipse to create Tomcat webapps and do not run standalone Java.
$ /usr/libexec/java_home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
1.8.121.13 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
1.8.0_121 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
1.7.0_60 (x86_64) "Oracle Corporation" - "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
In addition to all steps recommended above I had to create the following symlink:
cd /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib
sudo ln -s ../jre/lib/server/libjvm.dylib libserver.dylib
The version of the Eclipse I use is 4.4.1. (because tested to work well with WebObjects)
I had to install the latest version of Eclipse to make it work since that uses Java 11. This happened after I updated to Big Sur.
Step 1 : Uninstall jdk 8
Step 2 : Install openjdk14 by brew
Step 3 : install eclipse 2020-12 version
I deleted all Eclipse files that were already installed and just simply reinstalled with this --cask eclipse-jee on Home brew. I hope it's helpful for whoever is struggling just like past myself.
I experienced this issue while using Eclipse Mat and JDK Mission Control
On Mac OS v11.6 (Big Sur ) ,the dependency was Java 11 . The following was added in the whatever.app/Contents/Info.plist
<key>Eclipse</key>
<array>
<string>-vm</string
<string>/Users/<yourHomeDir>/.sdkman/candidates/java/11.0.2-open/bin/java</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
If you are using eclipse 2020-06 sure you will be facing pop-up with empty grey window when debugging.
No chance to use Big Sur with eclipse 2020-06 anymore. I'm using eclipse 2021-03 IDE developer and it's working fine. But STS not support anymore you have to manual change to old JAVA 1.8 for your project.
Right click project and properties
Configure Java Build Path
Libraries Tab -> Edit -> change to Java 1.8
Order and Export Tab -> move JRE System Library on top of Project and External Dependencies.
Apart from the suggestions given, I also had to do an additional step of removing eclipse app from quarantine :
1)Open up a shell
2)Cd yourself into the eclipse directory.
3)Check the attributes of the directory Eclipse.app/ $ xattr Eclipse.app/ com.apple.quarantine
4)Remove the ‘com.apple.quarantine’ attribute. $ xattr -d com.apple.quarantine Eclipse.app/
After completing this along with steps to edit the Info.plist, I was able to open Eclipse
Setting-security&privacy->Full Disk Access, add eclipse or Spring Tool Suite app.
brew install openjdk
add to /Applications/ApacheDirectoryStudio.app/Contents/Info.plist <dict>
<array>:
<string>-vm</string>
<string>/usr/local/opt/java/libexec/openjdk.jdk/Contents/Home/bin/java</string>

Mac OS: can't install Eclipse [duplicate]

I have formatted my Mac due to some storage issues. Before this, I used Eclipse in a proper way. Now i have installed the JDK
Then, i have installed Java
Until now everything seems to be correct but when I open the Eclipse installer...
What can I do to fix this? I need to work with this the soon as possible.
Thanks
Eclipse on macOS will not start with Java 14 installed, this is being tracked in Eclipse bug 561273.
Installing Java 8 as well does not help. You need to remove the Java 14 install. You could use the Java 13.0.2 release instead.
Eclipse have determined that the root cause of this issue is a change in Java 14 which is described in this bug report JDK-8238225. The fix for this should be in Java 14.0.1
Update: Eclipse runs fine with Oracle Java 14.0.1 so the issue has been fixed.
I also asked this question which was closed, that's why I answer what I have found out: Eclipse will not install on Mac OS Catalina 10.15.4, saying the above error message
Failed to create the Java Virtual Machine.
Deinstalling jdk and install an older one wouldn't help on its own because Eclipse is refusing to install in the first place (as mentioned above). What I have done:
i´ve installed an JDK with boost (you can try several, mine worked with Version 13)
I edited the installer:
Download the dmg file
convert the dmg-file with "hdiutil convert /dev/disk3s1 -format UDRW -o devimage"
mount the converted dmg-file with: "hdiutil attach -owners on devimage.dmg -shadow"
Edit the /Volumes/Eclipse/Eclipse.app/Contents/Info.plist: there is a section which is commented and there you can try the jdk version. You have to give the full path to the java executable, for example:
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/bin/java</string>
Then my eclipse started from the (already) mounted Eclipse image without complaining
I had the same issue myself a while back. In your Eclipsepedia it provided an example of what the eclipse.ini file looks like when your trying to specify a JVM. So just change the eclipse.ini file and then make sure that you have all of the correct documents in that path to match the example.

Netbeans 7.2.1 asks for netx.jar and plugin.jar files when debugging

How can i fix this issue. It's not causing any problems yet
Have no file for /usr/lib/jvm/java-6-openjdk-i386/jre/lib/netx.jar
Have no file for /usr/lib/jvm/java-6-openjdk-i386/jre/lib/plugin.jar
Linux OS
I was having this same problem. Fixed it on Ubuntu 12.0.4 by removing the jdk I already had, and going here to install jdk with Netbeans:
http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-142931.html
Not sure if that is the answer you're looking for, but might work for you.

how do you get a jre installed in eclipse/springsource toolsuite?

For some reason, when I go to add a JRE to eclipse/sts and give it the location of the JDK 1.6.0_22, it says:
Target is not a JDK root. System library was not found.
I am giving it this folder, which is accurate and works for everything else:
/opt/jdk1.6.0_22
But it is the jdk root. IDEA thinks so. Every other APP on the planet thinks so too. Aside: God, I really hate eclipse. This is why I never use it, because nothing works like it's supposed to. I just want to try Spring Insight out, so that's why I am using STS...
I am on Ubuntu 10.10 if that makes any difference.
Please help. I think I can finally get this to work if I can just get STS/Eclipse to stop being stupid :/
Are you sure you are pointing to the JDK folder and not the JRE folder ?
You must select the root folder of the JDK installation.
On Ubuntu (10.04, Lucid Lynx) I ran into this same problem. I was pointing at a directory that was a symbolic link (logical) to the actual JDK directory. I got around it by pointing directly at the physical JDK directory (this is going to be an issue when Java upgrades, but its the best I could figure out).
On a default install of Ubuntu, even though there was a JDK folder, I noticed it didn't have the right stuff.
I had to install the JDK using apt-get as follows
apt-get install openjdk-7-jdk

How to (re)attach JDK sources for Eclipse on Snow Leopard?

After updating to the latest (and now deprecated, sniff...) update of Apple's JDK, Eclipse does not show the source code for JDK classes anymore. It asks me to attach the source location file or folder. Where can I find that?
It seems that Java for Mac OS X 10.6 Update 3 does not include the sources anymore. There is a separate package "Java for Mac OS X 10.6 Update 3 Developer Package" now. See http://lookfirst.com/2010/10/how-to-fix-missing-source-for-latest.html
For each update from Apple, I write a new blog post with the updated symlinks. I noticed a lot of traffic on my blog from one of the answers, so I figured I might as well update things with the latest release.
I could write a simple shell script to do this for you, but that would require you to download a file. Seems simpler to just execute a few easy commands.
This is the latest one for update 5:
http://lookfirst.com/2011/06/fix-missing-source-for-java-mac-os-x.html
I am using Mac OS 10.8.5. I downloaded the java for Mac OS 10.7 and installed it. I found the src.jar file in
/Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/src.jar.
Then I
Opened eclipse(JUNO)
Eclipse > Prefereces > JAVA > Installed jre
Edit the java listed
In the jre system libraries section,
Expand the first one (i.e., classes.jar)
You can see that src is not attached
Double click that and provide the above location
That's it.
In my case the sources are in
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/src.jar
You might need to set this in the Eclipse preferences: Java - installed JREs. Select the 1.6 JVM and click edit. Now select classes.jar from the list of JRE system libraries, click source attachment and enter the path to your src.jar.
To all the guys who's been suffering from searching the source code here and there for hours but finally get nothing.
For Eclipse to attach(imperfectly available for 1.6):
jdk1.7.0_21_src_for_mac.zip