Install Java using SDKMAN! and switch with it.
When using SKDMAN! With Bash on Mac, 4 or more Bash was required, so install it in a timely manner.
$ brew install bash
$ sudo vim /etc/shells
At the end/usr/local/bin/Add bash
$ chsh -s /usr/local/bin/bash
Finally restart the terminal
If / usr / local / bin / bash
doesn't come first in the result below,
$ which -a bash
/bin/bash
/usr/local/bin/bash
Check / etc / paths
and move / usr / lobal / bin
before / bin
.
/etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Also, if the chsh execution result is chsh: no changes made
, change it from the Mac system environment settings.
(It may have changed when confirmed)
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
If you just want to install it, run sdk install java
to get the latest OpenJDK.
$ sdk install java
==== BROADCAST =================================================================
* 2019-04-02: Vertx 3.7.0 released on SDKMAN! #vertx
* 2019-03-28: Micronaut 1.1.0.RC2 released on SDKMAN! #micronautfw
* 2019-03-28: Gradle 5.3.1 released on SDKMAN! #gradle
================================================================================
Downloading: java 11.0.2-open
In progress...
######################################################################## 100.0%
Repackaging Java 11.0.2-open...
Done repackaging...
Cleaning up residual files...
Installing: java 11.0.2-open
Done installing!
Setting java 11.0.2-open as default.
Set JAVA_HOME if necessary.
.bashrc
export JAVA_HOME=$HOME/.sdkman/candidates/java/current
export PATH=$JAVA_HOME/bin:$PATH
Find the version you want to install and install Java
$ sdk list java
================================================================================
Available Java Versions
================================================================================
13.ea.14-open 8.0.202-amzn
12.0.0-zulu 8.0.202.j9-adpt
12.0.0-open 8.0.202.hs-adpt
11.0.2-sapmchn 8.0.202-zulufx
11.0.2-zulu 8.0.201-oracle
> * 11.0.2-open 7.0.181-zulu
11.0.2-amzn 1.0.0-rc-14-grl
11.0.2.j9-adpt 1.0.0-rc-13-grl
11.0.2.hs-adpt 1.0.0-rc-12-grl
11.0.2-zulufx 1.0.0-rc-11-grl
10.0.2-zulu 1.0.0-rc-10-grl
10.0.2-open 1.0.0-rc-9-grl
9.0.7-zulu 1.0.0-rc-8-grl
9.0.4-open
8.0.202-zulu
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
$ sdk install java 8.0.202-amzn
Change only specific terminals
$ sdk use java 8.0.202-amzn
Change the default of the JDK to use
$ sdk default java 8.0.202-amzn
Recommended Posts