Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to detect system JDK/JRE home #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lbragaglia
Copy link

... instead of ~/.jenv/versions/system, at least on Debian/Ubuntu systems (see #103 and #123 ).

Let jenv to play nicely with Debian alternatives system. My use case (Debian 8.3):

$ sudo update-java-alternatives -l
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64

$ jenv versions
* system (set by /home/lorenzo/.jenv/version)
  1.7
  1.7.0.91
  1.8
  1.8.0.66-internal
  openjdk64-1.7.0.91
  openjdk64-1.8.0.66-internal

$ java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-1~deb8u1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

$ jenv javahome
/usr/lib/jvm/java-7-openjdk-amd64

$ sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
[... plugin alternative errors, not relevant here ...]

$ java -version
openjdk version "1.8.0_72-internal"
OpenJDK Runtime Environment (build 1.8.0_72-internal-b15)
OpenJDK 64-Bit Server VM (build 25.72-b15, mixed mode)

$ jenv javahome
/usr/lib/jvm/java-8-openjdk-amd64

@gcuisinier
Copy link
Collaborator

Unfortunately, readlink -f does not work on OSX.

But It seems that greadlink from coreutils could be an alternative for osx.

Let jenv to play nicely with Debian alternatives system
@lbragaglia
Copy link
Author

@gcuisinier thank you for the advice, I picked the function resolve_link to choose between greadlink and readlink, already used in other commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants