Mashandisiro eBrew Kuisa Java paMac

Unogona kuve neshanduro dzakawanda dzeJava pane yako Mac.

Muchikamu chino tinoratidza maitiro ekuisa Java paMac uchishandisa Homebrew, uye maitiro ekubvumira kushandura pakati peshanduro dzakasiyana senge Java8, Java11, Java13 uye yazvino Java vhezheni.

Pre-zvinotarisirwa

Tisati tatanga, ita shuwa kuti une Homebrew yakaiswa pane yako Mac. Kana zvisiri, unogona kuiisa kuburikidza:

$ ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'

Tevere, isa Homebrew Cask

$ brew tap homebrew/cask-versions $ brew update $ brew tap caskroom/cask

Isa Dzazvino Shanduro yeJava Uchishandisa Bira

Kuisa yazvino vhezheni yeJava, zvese zvaunoda kuti uite ndezvi:

$ brew cask install java

Isa Zvinyorwa Zvakasarudzika zveJava (Java8, Java11, Java13)

Kuisa shanduro dzakapfuura kana dzakananga dzeJDKs, unogona kudziwana kubva kuAdoptOpenJDK:



$ brew tap adoptopenjdk/openjdk $ brew cask install adoptopenjdk8 $ brew cask install adoptopenjdk11 $ brew cask install adoptopenjdk13

Chinja Pakati Peakasiyana Mavhezheni eJava

Kana iwe uchida kuchinja pakati peshanduro dzakasiyana dzeJava, unofanirwa kuwedzera zvinotevera kune yako .bash_profile.

Mune ino kesi, isu tinoda kukwanisa kuchinja pakati peJava8 neJava11:

export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8) export JAVA_11_HOME=$(/usr/libexec/java_home -v11) alias java8='export JAVA_HOME=$JAVA_8_HOME' alias java11='export JAVA_HOME=$JAVA_11_HOME' # default to Java 11 java11

Dzokorora .bash_profile kuitira kuti zvibvumirano zviitwe.

$ source ~/.bash_profile

Ipapo, iwe unogona kushandisa aliases kushandura pakati akasiyana Java shanduro:

$ java8 $ java -version java version '1.8.0_261'

Mhedziso

Mune ino posvo isu takadzidza maitiro ekuisa chero vhezheni yeJava paMac uchishandisa Homebrew.