简体   繁体   中英

Spring STS 3.7.2 “No Java virtual Machine Found” on Mac OS X Yosemite

I have been using Spring STS 3.7.2 for a few months on my Mac laptop (Mac OS X Yosemite 10.10.5). But suddenly the STS IDE is not starting up. I suspect that one of the automatic OS update may have changed something, since I noticed that I don't see java any more on my path setting.

I manually added the following entries to my .bash_profile and updated using source command:

export PATH=$PATH:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/bin
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home

But STS stubbornly not working. It keeps giving me the error message in a dialog box:

A java runtime environment (JRE) or Java development kit (JDK) must be available in order to run STS. No Java virtual machine was found after searching ....

I am confused. I am able to invoke java from any terminal window, as well as JAVA_HOME environment variable is set.

Any ideas what may be going on?

After quite a bit of searching online, I figured out the problem, and resolved it for myself. It basically boils down to JDK upgrade to versions beyond 1.6.

The following link provided a solution:

https://apple.stackexchange.com/questions/178647/jdk-platform-not-recognized-running-eclipse-or-mvn

Here are the steps:

  1. Revert back to JDK 1.6: Download and install JDK 1.6 from this Apple site: https://support.apple.com/kb/DL1572?locale=en_US

  2. Change the PATH variable to point to the 'bin' directory of where JDK is installed. On my Mac, it was installed at: /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin

  3. Go to the STS application installed directory and run the command "open -a STS.app". This will open the STS IDE successfully.

  4. Exit STS.

  5. Now, if you want to use Java 8, then change the PATH variable to the Java 8 directory. On my Mac, it was at: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin

  6. Launch the STS app again, and voila!, the problem solved.

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