halcyon / asdf-java

A Java plugin for asdf-vm.
MIT License
466 stars 86 forks source link

Do not show "No version is set for command java" without global Java configuration and no Java version set locally #229

Open jarmo opened 4 months ago

jarmo commented 4 months ago

Having following conditions met:

  1. asdf java plugin has been installed
  2. set-java-home.bash sourced in ~/.bashrc
  3. No global Java version has been configured in ~/.tool-versions
  4. No local Java version configured in local directory or shell

Then opening a new terminal window or moving between directories causes the following annoying message to be shown every time:

No version is set for command java
Consider adding one of the following versions in your config file at 
java temurin-22.0.1+8

This PR hides this message by redirecting stderr of asdf which java command used by set-java-home.bash to /dev/null.

Similar problem probably exists for other supported shells, but since I don't use these then I can't test any changes.