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

Unset JAVA_HOME and JDK_HOME when no java version set by asdf #230

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

Conversation

jarmo
Copy link
Contributor

@jarmo jarmo commented Jul 18, 2024

Currently JAVA_HOME and JDK_HOME variables are set by set-java-home.bash when Java version is specified by asdf. This might cause JAVA_HOME and JDK_HOME to be persisted even when Java version is not specified anymore (for example navigating out of directory with local .tool-versions file).

For example:

~$ echo $JAVA_HOME

~$ cd project
~/project$ cat .tool-versions 
java temurin-22.0.1+8
~/project$ echo $JAVA_HOME 
/home/user/.asdf/installs/java/temurin-22.0.1+8
~/project$ cd ..
~$ echo $JAVA_HOME 
/home/user/.asdf/installs/java/temurin-22.0.1+8

This PR clears JAVA_HOME when it is not configured via asdf to keep it in sync. Similar problem probably exists for other supported shells, but since I don't use these then I can't test any changes.

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.

1 participant