Article
· Dec 2, 2015 1m read

Fixing Java version in OSX

Atelier needs Java 1.8 to run, but manage diferent versions of Java can be tricky in OSX

This command clear some problems:​
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
  1.8.0_60, x86_64:    "Java SE 8"    /Library/Java/JavaVirtualMachines/jdk1.8.0_60.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​

Oracle's installer puts java inside the /Library/Internet Plug-Ins/JavaAppletPlugin.plugin. And it doesn't overwrite /usr/bin/java. So, if you issue a

$ whereis java
in the terminal, it'll return /usr/bin/java. (which in turn points to /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java, which is Apple's 1.6 version).

So, if you want to use the new java version, replace the /usr/bin/java symlink so that it points to /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java instead:

$ sudo rm /usr/bin/java
$ sudo ln -s /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin

Discussion (9)1
Log in or sign up to continue

I think best practice these days is to embed the JRE with the Java app into a Mac OS X application package:

https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingApp...

This avoids problems with different Java runtime versions (at the cost of a little bit of disk space).

Any chance ISC could do this?

This might be of help as well:

http://blog.dadabeatnik.com/2013/02/04/bundling-a-jre-with-an-app/

If using OS 10.11 there is an additional security setting called system integrity protection. This can be disabled by booting into recovery mode which i have done.

I have then  followed  the instructions above but  get the following alert when starting up Atelier

the JVM shared library "/Library/internet plug-ins/javaappletplugin.plugin/contents/home/bin/../lib/server/libjvm.dylib" does not contain the J NI_createjavaVM symbol.

Any idea what this means ?

 

thanks

k

On Mac OS X.11 what fixed my Java problems was adding the following line to my .bash_profile:

export JAVA_HOME="$(/usr/libexec/java_home)"

Here is what I did:

Installed JDK 1.8 from Oracle site

Deinstalled JDK 1.6 from my Mac

Put the above in my .bash_profile

Restarted terminal so it picked up definitions in .bash_profile (I could have run from the terminal 

. ~/.bash_profile  )

Ref: the JVM shared library "/Library/internet plug ins/javaappletplugin.plugin/contents/home/bin/../lib/server/libjvm.dylib" 

 

This problem can be mitigated by installing the Java 1.8 JDK. Oracle states that the JRE does NOT update the symbolic links appropriately whereas the JDK does. Thus for MacOSX only we will now REQUIRE that the JDK be installed. We are sorry for any inconvenience this may cause but these are circumstances beyond our control. Thank you.

he JVM shared library "/Library/internet plug-ins/javaappletplugin.plugin/contents/home/bin/../lib/server/libjvm.dylib"