Otu esi etinye Java 17 (JDK 17) na Debian 11 Bullseye

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) ewepụtala nkwalite asụsụ ọhụrụ, mmelite na ọba akwụkwọ, nkwado maka kọmpụta Apple ọhụrụ, mwepụ na mmebi nke njirimara nketa, na ị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 Debian 11 Bullseye.

Prerequisites

  • OS akwadoro: Nnenna 11 Bullseye
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ihe ùgwù or ohere mgbọrọgwụ (su Command).
  • Ngwungwu achọrọ: curl

Na-emelite Sistemụ Ọrụ

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

sudo apt update && sudo apt upgrade

Mgbọrọgwụ ma ọ bụ Sudo Access

Site na ndabara, mgbe ị mepụtara akaụntụ gị na mmalite na Debian ma e jiri ya tụnyere nkesa ndị ọzọ, ọ naghị enweta ọkwa sudoers ozugbo. Ị ga-enwerịrị ike ịnweta ya mgbọrọgwụ paswọọdụ iji iwu su ma ọ bụ gaa na nkuzi nkuzi anyị Otu esi etinye onye ọrụ na Sudoers na Debian.


Advertisement


Wụnye Java JDK 17 – Usoro APT

Nhọrọ nke mbụ ga-abụ ịwụnye JDK site na ebe nchekwa Debian 11. Ugbu a, Java 17 dị na ebe nchekwa. Agbanyeghị, dịka ngwungwu nchekwa Debian niile nwere ike ịla azụ n'azụ ụdị ọhụrụ n'ọdịniihu n'aha nkwụsi ike.

Iji tinye njikwa ngwugwu APT, mebie iwu a:

sudo apt install openjdk-17-jre openjdk-17-jdk

Ihe atụ mmepụta:

Otu esi etinye Java 17 LTS (JDK 17) na Debian 11 Bullseye

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

Na-esote, gosi na nrụnye ahụ gara nke ọma site na ịlele ya iwu amụma apt-cache:

sudo apt-cache policy openjdk-17-jre openjdk-17-jdk

Ihe atụ mmepụta:

Otu esi etinye Java 17 LTS (JDK 17) na Debian 11 Bullseye

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

sudo apt autoremove openjdk-17-jre openjdk-17-jdk --purge

Ihe atụ mmepụta:

Otu esi etinye Java 17 LTS (JDK 17) na Debian 11 Bullseye

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

Wụnye Java JDK 17 – Usoro DPKG

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 Debian.

Nke mbụ, budata ya .deb ngwugwu si Ibe nbudata Java:

Ihe Nlereanya:

Otu esi etinye Java 17 LTS (JDK 17) na Debian 11 Bullseye

Download .deb ngwugwu site na ndekọ weebụsaịtị, 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 Debian 11 Bullseye

Wepu Java 17

Ọ bụrụ na ịchọghị JDK 17 ma tinyela ngwanro ahụ site na iji ngwugwu .deb JDK, ị nwere ike iji iwu dpkg na-esote ya na nhọrọ ọkọlọtọ -r 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 Debian 11 Bullseye

Advertisement


Wụnye Java JDK 17 – Usoro ntuziaka

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

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

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/jdk-17
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/jdk-17

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

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 Debian 11 Bullseye

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ụ.

Ahapụ a Comment