Otu esi etinye Java 17 LTS (JDK 17) na Ubuntu 20.04

Java bụ ebumnuche n'ozuzu, klaasị, asụsụ mmemme multipurpose nke na-ewu ewu nke na-ewu ewu n'ihi nhazi nke inwe mmejuputa mmejuputa iwu dị nta, nke pụtara na koodu Java a chịkọtara nwere ike ịgba ọsọ na nyiwe niile na-akwado Java na-enweghị mkpa nchikota. Java dịkwa ngwa ngwa, nchekwa na ntụkwasị obi, yabụ. A na-eji ya maka ịmepụta ngwa Java na laptọọpụ, ebe data, consoles egwuregwu, supercomputers sayensị, ekwentị mkpanaaka, wdg.

JDK 17 (JDK 17) ewetala nkwalite asụsụ ọhụrụ, mmelite na ọba akwụkwọ, nkwado maka kọmpụta Apple ọhụrụ, mwepụ na mmebi nke njirimara nketa, yana ịrụ ọrụ iji hụ na koodu Java edere taa ga-aga n'ihu na-arụ ọrụ na-enweghị mgbanwe na ụdị JDK n'ọdịnihu.

N'ime nkuzi a, ị ga-amụta otu esi etinye Java 17 (JDK 17) kacha ọhụrụ na Ubuntu 20.04.

Prerequisites

  • OS akwadoro: Ubuntu 20.04 ma ọ bụ karịa
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo or mgbọrọgwụ ohere.

Melite Sistemụ Ọrụ

Melite gi Ubuntu Sistemụ arụmọrụ iji hụ na ngwugwu niile dị adị adịla ugbu a:

sudo apt update && sudo apt upgrade -y

Nkuzi a ga-eji ya sudo iwu na na-eche na ị nwere ọnọdụ sudo.

Iji nyochaa ọkwa sudo na akaụntụ gị:

sudo whoami

Ihe atụ na-egosi ọkwa sudo:

[joshua@ubuntu ~]$ sudo whoami
root

Ka ịtọlite ​​akaụntụ sudo dị adị ma ọ bụ ọhụrụ, gaa na nkuzi anyị na Otu esi etinye onye ọrụ na Sudoers na Ubuntu.

Iji mgbọrọgwụ akaụntụ, jiri iwu na-esonụ na paswọọdụ mgbọrọgwụ banye.

su

Advertisement


Wụnye Java JDK 17 – APT PPA Method

Nhọrọ mbụ ga-abụ ịwụnye Java 17 JDK site na ppa: ebe nchekwa nchekwa. Ugbu a, Java 17 dị na PPA a. Nke a bụ ebe nchekwa na-abụghị nke gọọmentị, dị ka mgbe ọ bụla iji PPA ọ bụla na-akpachara anya yana n'ihe egwu nke gị.

Nke mbụ, bubata PPA site na iji iwu a na ọdụ gị:

sudo add-apt-repository ppa:linuxuprising/java -y
sudo apt update

Iji tinye njikwa ngwugwu APT, mebie iwu a:

sudo apt-get install oracle-java17-installer oracle-java17-set-default

Ihe atụ mmepụta:

Otu esi etinye Java 17 LTS (JDK 17) na Ubuntu 20.04

Mara, n'oge nrụnye, ị ga-achọ ịnakwere usoro Oracle.

Chọpụta na nrụnye ahụ gara nke ọma site na iji –ụdị iwu:

java 17 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)

Ka iwepu Java 17 JDK site na iji usoro njikwa ngwugwu dabara adaba, mee iwu a:

sudo apt autoremove oracle-java17-installer oracle-java17-set-default --purge

Ihe atụ mmepụta:

Otu esi etinye Java 17 LTS (JDK 17) na Ubuntu 20.04

ụdị "Y", wee pịa "Tinye igodo" ịga n'ihu na iwepụ.

Wụnye Java JDK 17 – Usoro DPKG

Wụnye ngwugwu ndabere

Iji wụnye JDK 17 nke ọma, ịkwesịrị ịwụnye ngwugwu ndị a.

sudo apt install libc6-i386 libc6-x32 curl -y

Wụnye Java 17

Nhọrọ dị mfe mana nke kachasị mma bụ ịwụnye Java JDK 17 site na iji dpkg iwu, nke bụ ngwá ọrụ iji wụnye, wuo, wepụ na jikwaa ngwugwu .deb.

Nke mbụ, budata ya .deb ngwugwu si Ibe nbudata Java, ma ọ bụ detuo na mado njikọ ahụ n'ime iwu wget na ọdụ gị.

Ihe Nlereanya:

wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.deb

Mara, njikọ a kwesịrị ịrụ ọrụ ma ọ bụrụ na ọ gaghị aga webụsaịtị iji nweta nke ọhụrụ.

Ozugbo ibudatara ya .deb ngwugwu, Gbaa iwu na-esonụ na ọdụ gị ka ịwụnye Java:

sudo dpkg -i jdk-17_linux-x64_bin.deb

Ihe atụ mmepụta:

Otu esi etinye Java 17 LTS (JDK 17) na Ubuntu 20.04

Wepu Java 17

Ọ bụrụ na ịchọghị Java JDK 17 ma tinyela ngwanro site na iji .deb JDK ngwugwu, ị nwere ike iji iwu dpkg na-esonụ na nhọrọ ọkọlọtọ -r nke ga-ewepụ ngwugwu ahụ dịka ọmụmaatụ n'okpuru:

sudo dpkg -r jdk-17

Ihe atụ mmepụta:

Otu esi etinye Java 17 LTS (JDK 17) na Ubuntu 20.04

Advertisement


Wụnye Java JDK 17 – Usoro ntuziaka

Nhọrọ nke abụọ na nke akwadoro bụ ịwụnye Java JDK 17, ụzọ ntuziaka na-abara ndị ọrụ uru nnwere onwe na ike na ihe ha chọrọ na ebe etinyere na sistemụ ha.

Wụnye ngwugwu ndabere

Iji wụnye Java JDK 17 nke ọma, ịkwesịrị ịwụnye ngwugwu ndị a.

sudo apt install libc6-i386 libc6-x32 curl -y

Budata Java 17 Mee Kacha ọhụrụ

gaa Leta ibe nbudata ka ị nweta njikọ ụdị nrụpụta kacha ọhụrụ, wee jiri nke a iwu iwu:

curl  -O https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz

Ozugbo nbudata ahụ gwụchara, ịkwesịrị iwepụ ebe nchekwa ahụ dịka ndị a:

tar -xvf jdk-17_linux-x64_bin.tar.gz

Hazie ma wụnye Java 17

Na-esote, bugharịa akwụkwọ ndekọ aha ewepụtara n'ime / họrọ / ebe:

sudo mv jdk-17 /opt/jdk17

Ugbu a ịkwesịrị ịtọ mgbanwe mgbanwe gburugburu ebe a:

export JAVA_HOME=/opt/jdk17
export PATH=$PATH:$JAVA_HOME/bin

Awụnyela Java 17 ugbu a. Iji gosi, jiri iwu ndị a:

java --version
echo $JAVA_HOME

Ọ bụrụ na arụnyere ya nke ọma, ị ga-ahụ nsonaazụ a:

java 17 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
/opt/jdk17

Dị ka ị pụrụ ịhụ, ị ​​pụrụ ịhụ na mbipute bụ ọhụrụ Java 17 JDK wuru.

Nwalee Java - Mepụta ngwa ụwa ndewo

Iji mechaa, ọ na-adị mma mgbe niile ịnwale nrụnye nke ụdị ndị a iji gosi na ihe niile na-arụ ọrụ nke ọma mgbe etinyechara ya. Ụzọ dị mfe bụ ịmepụta obere edemede mmemme iji nwalee iji ụwa ndewo a ma ama.

Mbụ, mepụta faịlụ mmemme Java dị ka ndị a

sudo nano hello.java

Ọzọ, tinye koodu Java ndị a n'ime faịlụ a:

public class hello {
  public static void main(String[] args) {
    System.out.println("G'day from LinuxCapable!");
  }
}

Chekwaa faịlụ (CTRL+O), wee pụọ (CTRL+X).

Ọzọ, chịkọta koodu:

javac hello.java

N'ikpeazụ, jiri iwu a mee koodu Java:

java hello

Ihe atụ mmepụta:

Otu esi etinye Java 17 LTS (JDK 17) na Ubuntu 20.04

Ekele, ihe niile na-arụ ọrụ nke ọma.


Advertisement


Okwu na mmechi

N'ime nkuzi a, ị mụtala otu esi ebudata ma wụnye Java 17 (JDK 17) kachasị ọhụrụ. N'ozuzu, maka ndị mmepe ịkwalite Java nwere ike ịbụ ọrụ na-egbu mgbu, mana n'ime ogologo oge, ịkwalite Java 17 ga-aba uru ebumnuche ịbụ nkwado ụdị LTS ga-adị gburugburu yana nkwalite ruo oge ụfọdụ.

Idenye aha
Gwa nke
0 Comments
Inline nzaghachi
Lee echiche niile
0
Ga-ahụ n'anya gị echiche, biko okwu.x