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

JAVA_HOME not set properly when "system" is set to be global #422

Open
smlchen opened this issue Feb 20, 2024 · 0 comments · May be fixed by #430
Open

JAVA_HOME not set properly when "system" is set to be global #422

smlchen opened this issue Feb 20, 2024 · 0 comments · May be fixed by #430
Milestone

Comments

@smlchen
Copy link

smlchen commented Feb 20, 2024

> java --version
openjdk 21.0.2 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode)
> /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
> jenv --version
jenv 0.5.6
> jenv doctor
[OK]    JAVA_HOME variable probably set by jenv PROMPT
[OK]    Java binaries in path are jenv shims
[OK]    Jenv is correctly loaded
> jenv versions
* system (set by /Users/sachen/.jenv/version)
  corretto64-1.8.0.342
  oracle64-17.0.5
  temurin64-11.0.17
> echo "${JAVA_HOME}"
/Users/sachen/.jenv/versions/system
> ls /Users/sachen/.jenv/versions/system
"/Users/sachen/.jenv/versions/system": No such file or directory (os error 2)

My system Java was installed via homebrew

@smlchen smlchen changed the title JAVA_HOME not set property when "system" is set to be global JAVA_HOME not set properly when "system" is set to be global Feb 20, 2024
andrewflbarnes added a commit that referenced this issue Mar 16, 2024
fix: Skip setting `JAVA_HOME` when using system JDK #422
andrewflbarnes added a commit to andrewflbarnes/jenv that referenced this issue Mar 16, 2024
andrewflbarnes added a commit to andrewflbarnes/jenv that referenced this issue Mar 16, 2024
andrewflbarnes added a commit to andrewflbarnes/jenv that referenced this issue Mar 16, 2024
andrewflbarnes added a commit to andrewflbarnes/jenv that referenced this issue Mar 18, 2024
andrewflbarnes added a commit to andrewflbarnes/jenv that referenced this issue Mar 19, 2024
andrewflbarnes added a commit to andrewflbarnes/jenv that referenced this issue Mar 20, 2024
@andrewflbarnes andrewflbarnes added this to the 0.5.8 milestone Mar 21, 2024
andrewflbarnes added a commit to andrewflbarnes/jenv that referenced this issue Mar 22, 2024
Use the current env JAVA_HOME when using the system version, or use the
JAVA_HOME from when it was last set.
andrewflbarnes added a commit to andrewflbarnes/jenv that referenced this issue Mar 30, 2024
Use java from the path with jenv shims and locations removed.
Set JAVA_HOME to be the linked java home from above, if it exists,
otherwise search for OS utility programs which can pinpoint the javahome
like libexec java_home or alternatives.
Fallback to whatever JAVA_HOME is currently set to if it can't otherwise
be resolved.
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 a pull request may close this issue.

2 participants