Izingxenye zeJava zidinga ukuqhuba izinhlobo eziningi zokusebenza kanye namawebhusayithi, ngakho cishe wonke umsebenzisi wekhompyutha ubhekene nesidingo sokufaka le platform. Yiqiniso, isimiso sokwenza umsebenzi sihlukile kumahlelo ahlukene asebenzayo, kodwa ngokusabalalisa kwe-Linux njalo kuyafana, futhi singathanda ukutshela indlela i-Java efakwe ngayo ku-Ubuntu. Abanikazi bezinye izinhlangano bazodinga kuphela ukuphinda imiyalelo enikeziwe, kucatshangelwa i-syntax yesistimu.
Faka Java JRE / JDK ku-Linux
Namuhla sinikeza ukuthi sijwayele ukukhetha okuhlukile kokufakwa kwelabhulali yeJava, ngoba konke kuzoba usizo kakhulu futhi kusebenza ezimweni ezithile. Isibonelo, uma ungafuni ukusebenzisa izintambo zangaphandle, noma uma ufuna ukubeka eceleni kweJava eceleni, kufanele usebenzise okukhethwa kukho. Noma kunjalo, ake siwabheke ngokucophelela kubo bonke.
Okokuqala, kutuswa ukuhlola izibuyekezo zesitoreji sesistimu futhi uthole inguqulo yamanje yeJava, uma ikhona ku-OS nhlobo. Lokhu konke kwenziwa nge-console ejwayelekile:
- Vula imenyu bese ugijima "Isikhumbuzo".
- Faka iqembu
sudo apt-get update
. - Faka iphasiwedi yakho ye-akhawunti ukuze uthole ukufinyelela kwezimpande.
- Ngemuva kokuthola amaphakheji, sebenzisa umyalo
i-java -version
ukubuka ulwazi mayelana ne-java efakwe. - Uma uthola isaziso esifana nesezansi, i-Java ayikho ku-OS yakho.
Indlela 1: Okushiwo Okusemthethweni
Indlela elula ukusebenzisa i-repository esemthethweni ukulanda i-Java, yiziphi izithuthukisi ezilayishiwe lapho. Kudingeka ubhalise imiyalo embalwa ukwengeza zonke izingxenye ezidingekayo.
- Qalisa "Isikhumbuzo" bese ubhala khona
sudo apt-get install ukuzenzakalela-jdk
bese uchofoza Ngena. - Qinisekisa ukufaka kwamafayela.
- Manje engeza i-JRE ngokuthayipha
sudo apt-get install okuzenzakalelayo-jre
. - I-plugin yesiphequluli eyengeziwe nge-intanethi
sudo apt-get ukufaka icedtea-plugin
. - Uma unesithakazelo ekutholeni amadokhumenti ngokuphathelene nezinsimbi ezengeziwe, zilayishe ngomyalo
sudo apt-get install okuzenzakalelayo-jdk-doc
.
Nakuba le ndlela ilula, ayihambisani nokufaka amashabhulali e-freshest eJava, ngoba awazange abekwe endaweni yokugcina esemthethweni. Yingakho sinikela ukuze sijwayele okukhethwa kukho okulandelayo.
Indlela 2: Indawo ye-Webupd8
Kukhona indawo yokugcina yezifiso ebizwa ngokuthi i-Webupd8, lapho kukhona iskripthi esichaza inguqulo ye-Java yamanje neyatholakala kuwebhusayithi ye-Oracle. Le ndlela yokufaka iyasiza kulabo abafisa ukufaka ibhodi entsha 8 (yakamuva etholakala endaweni yokugcina ye-Oracle).
- Ku-console, faka
i-sudo engeza-apt-repository ppa: webupd8team / java
. - Qiniseka ukuthi ufake iphasiwedi yakho.
- Qinisekisa umsebenzi wokufaka ngokuchofoza Ngena.
- Linda ukulanda ifayela ukuqedela ngaphandle kokuvala "Isikhumbuzo".
- Buyekeza isitoreji sesistimu ngomyalo
sudo apt-get update
. - Manje engeza isifaki sokubonisa ngokuthayipha
sudo apt-get ukufaka i-oracle-java8-installer
. - Yamukela isivumelwano selayisensi ukwenza ngokwezifiso iphakheji.
- Vumelanisa ukwengeza amafayela amasha ohlelweni.
Ekupheleni kwenqubo, uzotholakala eqenjini ukufaka ngokuphelele noma yiliphi uhlobo -sudo apt-get ukufaka i-oracle-java7-installer
kuphi java7 - Java version. Isibonelo, ungakwazi ukubhalisajava9
nomajava11
.
Umyalo uzosiza ukuqeda izifaki ezingadingekile.sudo apt-get ukususa i-oracle-java8-installer
kuphi java8 - Java version.
Indlela 3: Buyekeza nge-Webupd8
Ngenhla, sikhulume ngokufaka imihlangano ngokusebenzisa i-repository yangokwezifiso ye-Webupd8. Ngenxa yokugcina efanayo, ungabuyekeza inguqulo ye-Java ibe yamuva nje ngokubhala ngokukhathanisa.
- Phinda izinyathelo ezinhlanu zokuqala emfundweni yangaphambilini, uma ungakaze wenze lezi zinyathelo.
- Faka iqembu
sudo update-java
bese uchofoza Ngena. - Sebenzisa umyalo
sudo apt-get install update-java
ukufaka izibuyekezo uma zitholakala.
Indlela 4: Ukufakwa Kwamagama
Mhlawumbe le ndlela yinkimbinkimbi kunalabo esixoxe ngakho kulesi sihloko, kodwa iyohlinzeka ngenguqulo edingekayo yeJava ngaphandle kokusebenzisa izinqolobane zangaphandle kanye nezinye izingxenye ezengeziwe. Ukufeza lo msebenzi uzodinga noma yisiphi isiphequluli esitholakalayo futhi "Isikhumbuzo".
- Ngesiphequluli sewebhu, yiya ekhasini elisemthethweni le-Oracle ukulanda i-Java, lapho uchofoza khona Landa noma ukhethe noma iyiphi enye inguqulo edingekayo.
- Ngezansi amaphakheji amaningana anezincwadi. Sincoma ukulanda ingobo yomlando. i-tar.gz.
- Zulayela kufolda yakho ngedokhumenti, chofoza ku-RMB bese ukhetha "Izakhiwo".
- Khumbula indawo yephakheji, ngoba kufanele uhambe kuyo ngokusebenzisa i-console.
- Qalisa "Isikhumbuzo" futhi wenze umyalo
cd / ekhaya / umsebenzisi / ifolda
kuphi umsebenzisi - igama lomsebenzisi, futhi ifolda - igama lefolda yesitoreji se-archive. - Dala ifolda ukuze usule umlando wokugcina. Ngokuvamile zonke izingxenye zifakwa ku-jvm. Ukudala isiqondisi kwenziwa ngokuthayipha
sudo mkdir -p / usr / lib / jvm
. - Khipha i-archive ekhona kufolda edalwe
i-sudo tar -xf jdk-11.0.2_linux-x64_bin.tar.gz -C / usr / lib / jvm
kuphi jdk-11.0.2_linux-x64_bin.tar.gz - igama lomlando. - Ukuze ungeze izindlela ze-system, udinga ukufaka njalo imiyalo elandelayo:
sudo update-alternatives - susa / usr / bin / java java /usr/lib/jvm/jdk1.8.0/bin/java 1
sudo update-alternatives - khipha / usr / bin / javac javac /usr/lib/jvm/jdk1.8.0/bin/javac 1
sudo update-alternatives - khipha / usr / bin / javaws javaws /usr/lib/jvm/jdk1.8.0/bin/javaws 1Enye yezinye izindlela ezingahle zingekho, kuye ngokuthi yi-Java oyikhethayo.
- Ihlala kuphela ukulungisa indlela ngayinye. Qalisa kuqala
sudo update-ezinye izindlela - inkinobho java
, thola inguqulo efanele yeJava, uqinisekise inombolo yayo bese ufaka ku-console. - Phinda isenzo esifanayo
sudo update-alternatives --config javac
. - Bese ulungisa indlela yokugcina
sudo update-alternatives --config javaws
. - Hlola impumelelo yezinguquko ngokuthola inguqulo esebenzayo ye-Java (
i-java -version
).
Njengoba ungabona, kunezinhlobo eziningi zezindlela zokufaka i-Java kuhlelo lokusebenza lwe-Linux, ngakho-ke umsebenzisi ngamunye uzothola ukhetho olufanele. Uma usebenzisa ukusatshalaliswa okuqondile nezindlela ezinikeziwe zingasebenzi, buyekeza ngokucophelela amaphutha aboniswe ku-console futhi usebenzise imithombo esemthethweni ukuxazulula inkinga.