Java components yuav tsum khiav ntau ntau daim ntaub ntawv thiab cov websites, yog li yuav luag txhua tus neeg siv computer yog muag nrog qhov xav tau los nruab rau lub platform no. Tau kawg, txoj cai ntawm kev ua hauj lwm txawv nyob rau hauv ntau lub operating systems, tab sis nrog Linux distributions nws yog ib txwm txog tib yam, thiab peb xav qhia li cas Java yog ntsia hauv Ubuntu. Cov tswv ntawm lwm cov rooj sib tham tsuas yog yuav tsum tau rov hais dua cov lus qhia, uas suav cov ntsiab lus ntawm lub system.
Nruab Ib Yam Java JRE / JDK hauv Linux
Niaj hnub no peb muaj kev pom zoo nrog kev sib txawv installation rau Java cov tsev qiv ntawv, txij li tag nrho ntawm lawv yuav yog cov tseem ceeb thiab siv tau rau qee lub sijhawm. Piv txwv li, yog tias koj tsis xav siv lwm tus neeg koom haum, los sis yog tias koj xav muab ob peb sab Java, ces koj yuav tsum siv lwm txoj kev xaiv. Txawm li cas los xij, cia saib xyuas txhua yam.
Ua ntej, nws pom zoo kom pom lub kaw lus cia tshiab thiab xyuas seb qhov tam sim no version ntawm Java, yog nws nyob hauv OS txhua lub sijhawm. Qhov no yog txhua yam ua tiav los ntawm tus qauv tsim:
- Qhib cov zaub mov thiab khiav "Terminal".
- Sau pawg
sudo apt-tau hloov tshiab
. - Sau koj tus password kom tau txais cov hauv paus hniav.
- Tom qab tau txais cov pob, siv qhov kev hais kom ua
java -version
mus saib cov ntaub ntawv hais txog java ntsia. - Yog hais tias koj tau txais ib qho kev ceeb toom zoo ib yam hauv qab no, ces Java tsis nyob hauv koj OS.
Txoj Cai 1: Kev Raug Tshaj Lij (Repositories)
Qhov yooj yim txoj kev yog siv tus nom repository mus download tau Java, uas developers unloaded muaj. Koj yuav tsum tso npe rau ob peb lus txib kom ntxiv tag nrho cov khoom tsim nyog.
- Khiav mus "Terminal" thiab sau muaj
sudo apt-mus nruab default-jdk
thiab ces nias rau Sau. - Tshawb xyuas cov ntaub ntawv ntxiv.
- Tam sim no ntxiv JRE los ntawm hom ntawv
sudo apt-mus nruab default-jre
. - Lub plugin browser uas ntxiv ntawm
sudo apt-mus nruab icedtea-plugin
. - Yog tias koj xav tau cov ntaub ntawv khaws tseg nrog kev txiav txim siab mus rau lub cheebtsam ntxiv, muab lawv nrog qhov kev hais kom ua
sudo apt-mus nruab default-jdk-doc
.
Txawm hais tias hom no nws yooj yim heev, nws tsis haum rau kev txhim kho cov khoom siv tshiab hauv Java, txij li thaum lawv tsis tau muab tso rau hauv qhov chaw pov thawj tsis ntev los no. Yog vim li cas peb thiaj li tau txais kev paub nrog cov kev xaiv hauv qab no.
Txoj kev 2: Webupd8 repository
Muaj ib qho kev cai repository hu ua Webupd8, nyob rau hauv uas muaj ib tsab ntawv uas sib piv qhov tam sim no Java version nrog rau ib qho nyob rau ntawm Oracle lub website. Txoj kev teeb tsa no yog qhov tseem ceeb rau cov neeg uas xav los nruab ib lub xov tooj tshiab 8 (qhov tseeb muaj nyob rau hauv Oracle repository).
- Hauv lub console, sau
sudo ntxiv-apt-repository ppa: webupd8team / java
. - Nco ntsoov sau koj tus password.
- Tshawb xyuas lub lag luam ntxiv los txhaj rau Sau.
- Tos rau hauv cov ntaub ntawv kom tiav tsis tas kaw "Terminal".
- Hloov kho qhov system cia nrog cov lus txib
sudo apt-tau hloov tshiab
. - Tam sim no ntxiv cov graphical installer los ntaus ntawv
sudo apt-mus nruab oracle-java8-installer
. - Txais daim ntawv tso cai pom zoo rau customize lub pob.
- Pom zoo kom ntxiv cov ntaub ntawv tshiab rau lub system.
Qhov kawg ntawm tus txheej txheem, koj yuav muaj rau pab neeg no nruab ib txoj cai twg kiag li -sudo apt-mus nruab oracle-java7-installer
qhov twg java7 - Java version. Piv txwv li, koj tuaj yeem tso npejava9
los yogjava11
.
Qhov kev hais kom ua yuav pab kom tshem tau cov neeg tsim kev ruaj ntseg.sudo apt-tau tawm oracle-java8-installer
qhov twg java8 - Java version.
Method 3: Hloov tshiab nrog Webupd8
Saum toj no, peb tham txog kev txhim kho cov rooj sib txoos los ntawm kev siv tus txheej txheem repository ntawm Webupd8. Tsaug rau qhov qub repository, koj tuaj yeem hloov Java version rau qhov tseeb ib zaug los ntawm txoj kev sib piv tsab ntawv.
- Rov ua ntej thawj tsib kauj ruam ntawm qhov kev qhia dhau los, yog tias koj tsis tau ua qhov no.
- Sau pawg
sudo hloov tshiab-java
thiab ces nias rau Sau. - Siv qhov kev hais kom ua
sudo apt-mus nruab hloov-java
los nruab tshiab yog tias lawv pom.
Txoj Kev 4: Kev Sau Ntawv Nrov
Tej zaum qhov no yog qhov nyuaj tshaj plaws ntawm cov uas peb tau tham hauv tsab xov xwm no, tab sis nws yuav muab qhov tsim nyog rau Java tsis tas siv cov khoom thib peb thiab lwm yam ntxiv. Yuav kom ua tiav txoj hauj lwm no koj yuav tsum muaj qhov browser muaj thiab "Terminal".
- Ntawm lub vev-xaij, mus rau ntawm nplooj ntawv Oracle nplooj mus download tau Java, nias rau Download tau los yog xaiv lwm cov ntaub ntawv tsim nyog.
- Hauv qab no yog ntau lub pob khoom nrog qiv. Peb pom zoo los daus qhov hom archive. tar.gz.
- Next rau lub nplaub tshev nrog archive, nias rau ntawm nws RMB thiab xaiv "Cov khoom".
- Nco ntsoov qhov chaw ntawm lub pob, vim hais tias koj yuav tsum mus rau nws los ntawm lub console.
- Khiav mus "Terminal" thiab ua raws li lo lus txib
cd / tsev / neeg / khoob
qhov twg tus neeg siv - username, thiab nplaub tshev - lub npe ntawm cov archive cia nplaub tshev. - Tsim kom muaj nplaub tshev kom muab lub zeem cia. Feem ntau tag nrho cov khoom raug tso rau hauv jvm. Tsim ib phau ntawv yog ua los ntawm kev ntaus ntawv
sudo mkdir -p / usr / lib / jvm
. - Unpack cov archive uas twb muaj lawm rau hauv cov nplaub tshev tsim
sudo tar -xf jdk-11.0.2_linux-x64_bin.tar.gz -C / usr / lib / jvm
qhov twg jdk-11.0.2_linux-x64_bin.tar.gz - archive lub npe. - Yuav ntxiv cov kab ke kev khiav dej num, koj yuav tsum ua raws li cov lus hauv qab no:
sudo hloov-cawm - nruab / usr / bin / java java /usr/lib/jvm/jdk1.8.0/bin/java 1
sudo hloov-cawm - nruab / usr / bin / javac javac /usr/lib/jvm/jdk1.8.0/bin/javac 1
sudo hloov-cawm - nruab / usr / bin / javaws javaws /usr/lib/jvm/jdk1.8.0/bin/javaws 1Ib qho ntawm lwm txoj kev paths tsis muaj nyob, nyob ntawm seb lub version ntawm Java koj xaiv.
- Nws tseem tshua tsuas yog kho kom haum txhua txoj kev. Thawj zaug khiav
sudo hloov tshiab-cawm --config java
, nrhiav qhov tsim nyog version ntawm Java, xyuas nws tus xov tooj thiab nkag mus rau hauv lub console. - Rov ua zoo tib yam nkaus
sudo hloov tshiab-cawm --config javac
. - Ces configure qhov kawg dhau los
sudo hloov tshiab-kev hloov --config javaws
. - Kos cov kev vam meej ntawm cov kev hloov los ntawm kev nrhiav kom paub cov nquag version ntawm Java (
java -version
).
Raws li koj tau pom, muaj ntau ntau txoj kev txhim kho Java rau hauv Linux operating system, yog li txhua tus neeg siv yuav pom ib qho kev xaiv. Yog tias koj siv cov khoom faib tawm thiab cov hau kev ua haujlwm tsis ua haujlwm, ua tib zoo xyuas cov teeb meem uas pom nyob hauv console thiab siv cov kev pabcuam los daws qhov teebmeem.