3 ms·
You don't need extra projects to manage this stuff anymore. There is a great answer here... https://stackoverflow.com/questions/52524112/how-do-i-install-java-
by latchkey 7y ago
You don't need extra projects to manage this stuff anymore.
There is a great answer here... https://stackoverflow.com/questions/52524112/how-do-i-install-java-on-mac-osx-allowing-version-switching https://stackoverflow.com/questions/52524112/how-do-i-instal...
brew install java (12)
brew install java11
And you can simplify things...
In your .bashrc:
export JDK_HOME=`/usr/libexec/java_home -v 12` # v9+ change to the version you installed
export JAVA_PATH=$JDK_HOME
export JAVA_HOME=$JDK_HOME
export PATH="."
export PATH="${PATH}:${JAVA_HOME}/bin"
- notyourwork 7y agoIncredible, thanks for sharing this.
- giancarlostoro 7y agoHomebrew is only useful for macOS users though sadly.
- bradyd 7y agoHomebrew will work on Linux and the Windows Subsystem for Linux as well. I'm not sure how well it works there, though, as I've only used it on macOS. https://docs.brew.sh/Homebrew-on-Linux https://docs.brew.sh/Homebrew-on-Linux
- microcolonel 7y agoOn Arch Linux, OpenJDKs from 8 through 12 are packaged in the main repositories, and there's a convenient shell utility for switching them (with symlinks, rather than environment variables, so that you can change the default in shells that have already started).
- nobleach 7y agoI'm a big fan of SDKMan for handling my Java/Kotlin/Gradle releases. It works across all the major platforms. Homebrew is great on macOS, but kinda non-existent on other platforms.
- jillesvangurp 7y agoI use it together with jenv so I can switch between versions easily. Jenv does not allow you to install versions. Sdkman makes it hard to switch between versions but together they solve the problem.
- Yhippa 7y agoHuge fan of SDKMan. Just wish it was friendlier with Windows.