3
votes

On my Mac-pro OS-X Yosemite, I install java7 and java8 using Jenv.

$ brew cask install java8

$ brew cask install java7

Then execute the "jenv add" commands as followed for each java:

$ sudo jenv add /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/

oracle64-1.7.0.80 added

I can see both at /Users/xxxxx/.jenv/versions

$ ls -lrt

lrwxr-xr-x 1 root staff 64 Feb 1 13:42 oracle64-1.8.0.121 -> /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home

lrwxr-xr-x 1 root staff 63 Feb 1 13:49 oracle64-1.7.0.80 -> /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home

But when I try to set java8 as global, it says that java8 is not installed.

$ jenv global oracle64-1.8.0.121

jenv: version `oracle64-1.8.0.121' not installed

Did I miss anything here? How can I fix this issue?

1
my experience with trying to have dual jvms in OS X is : don't do it. Unless there is an express need, don't do it. In the apple java dev list there are still people who can help you with thisefekctive
In my case, jenv was complaining about missing version '13'. I fixed this by editing ~/.jenv/version where I replaced '13' with the most recent version that I added to jenv before, this was '13.0.1'.JustCode

1 Answers

0
votes

I have the same problem. I solved this by edited the file /Users/[YourName]/.java-version myself. For example, I entered oracle64-1.8.0.121 as the first line in this file.