5

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?

dkb
  • 4,389
  • 4
  • 36
  • 54
Saigon7
  • 51
  • 1
  • 3
  • 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 this – bichito Feb 02 '17 at 01:42
  • 1
    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 Jan 12 '20 at 13:07

3 Answers3

2

For me, I discovered that jenv creates soft links for various 'versions' it controls, but it wouldn't create the soft link without the .0. So if something wants java 11, and my team somehow uses 11 as the jenv version, I wouldn't have 11... I would have 11.0

I resolved this by adding a soft link for the number I needed under: ~/Users/<my_home>/.jenv/versions

1

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.

0

Use following steps

depoddar-mac:inbound depoddar$ jenv versions
* system (set by /Users/depoddar/.jenv/version)
  1.7
  1.7.0.80
  1.8
  1.8.0.333
  11.0
  11.0.15
  17.0
  17.0.3
  openjdk64-11.0.15
  openjdk64-17.0.3
  oracle64-1.7.0.80
  oracle64-1.8.0.333
depoddar-mac:inbound depoddar$ jenv global oracle64-1.8.0.333
depoddar-mac:inbound depoddar$ jenv version
oracle64-1.8.0.333 (set by /Users/depoddar/.jenv/version)
depoddar-mac:inbound depoddar$ jenv versions
  system
  1.7
  1.7.0.80
  1.8
  1.8.0.333
  11.0
  11.0.15
  17.0
  17.0.3
  openjdk64-11.0.15
  openjdk64-17.0.3
  oracle64-1.7.0.80
* oracle64-1.8.0.333 (set by /Users/depoddar/.jenv/version)
Debopam
  • 3,198
  • 6
  • 41
  • 72