Saturday, 22 February 2014

Mavericks - I installed "jenv" to master the Java versions

Since I got stuck with the Java installations, I've found "jenv" and installed it in my wish to master the Java versions.

I have read about jenv here.

I have successfully added the Java 1.6 path to jenv
    $ jenv add /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

but currently this is failing in doing the same with the Java 7 path:

    $ jenv add "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

The options so far:
- either find out how to add the path above (it currently stucks due to the "Internet Plug-Ins" folder name, containing a space.
- or find out a way to install Java 7 in another folder, similar to Java 1.6


I'll come back with details once resolved.

Updates:
I have created a symlink for the Java 1.7

$ ln -s '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home' /System/Library/Java/JavaVirtualMachines/1.7.0_51.sdk/Contents/Home

This then was easy to add to jenv
 $ jenv add /System/Library/Java/JavaVirtualMachines/1.7.0_51.sdk/Contents/Home

then check the available versions
$ jenv versions
* system (set by /Users/gutiuc/.jenv/version)
  oracle64-1.6.0.65
  oracle64-1.7.0.51

then set globally the Java 1.7

$ jenv global oracle64-1.7.0.51

and finally check the set version of Java:

$ jenv versions
  system
  oracle64-1.6.0.65
* oracle64-1.7.0.51 (set by /Users/gutiuc/.jenv/version)

or

$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

 I will now switch back to IntelliJ and Maven to make them work with Java 1.7.

No comments: