Otu esi etinye Java 16 (OpenJDK 16) na Rocky Linux 8

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.

N'ime nkuzi a, ị ga-amụta otu esi etinye Java 16 kacha ọhụrụ (OpenJDK 16) na Rocky Linux 8.

Prerequisites

  • OS akwadoro: Rocky Linux 8.+.
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ma ọ bụ ohere mgbọrọgwụ.
  • Ngwungwu achọrọ: curl

Melite Sistemụ Ọrụ

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

sudo dnf upgrade --refresh -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@rockylinux ~]$ sudo whoami
root

Ọ bụrụ na ịtọbeghị akaụntụ onye ọrụ sudo ma ọ ga-amasị gị, gaa na nkuzi anyị Otu esi etinye onye ọrụ na Sudoers na Rocky Linux.

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

su

Wụnye ngwugwu Curl

Ị ga-achọ ka etinye curl maka nkuzi a. Iji chọpụta ma ị nwere curl, jiri ihe ndị a:

curl --version

Ihe atụ mmepụta:

[joshua@localhost ~]$ curl --version
curl 7.61.1 (x86_64-redhat-linux-gnu) libcurl/7.61.1 OpenSSL/1.1.1g zlib/1.2.11 brotli/1.0.6 libidn2/2.2.0 libpsl/0.20.2 (+libidn2/2.2.0) libssh/0.9.4/openssl/zlib nghttp2/1.33.0
Release-Date: 2018-09-05

Iji wụnye curl ọ bụrụ na ọ na-efu, mebie iwu a:

sudo dnf install curl -y

Mara, ịwụnye curl na-enweghị ịlele agaghị emerụkwa ahụ.


Advertisement


Wụnye (OpenJDK 16)

Site na ndabara, Java anaghị abịa arụnyere na Rocky Linux App iyi, yana ịchọta ụdị Java dị ka 16.0.2 kachasị ọhụrụ, ị ga-eji aka tinye ihe ndị a. Otú ọ dị, usoro a dịtụ mfe.

Budata Java 16 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.java.net/java/GA/jdk16.0.2/d4a915d82b4c4fbb9bde534da945d746/7/GPL/openjdk-16.0.2_linux-x64_bin.tar.gz

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

tar -xvf openjdk-16.0.2_linux-x64_bin.tar.gz

Hazie ma wụnye Java 16

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

sudo mv jdk-16.0.2 /opt/

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

export JAVA_HOME=/opt/jdk-16.0.2
export PATH=$PATH:$JAVA_HOME/bin

Awụnyela Java 16 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:

Otu esi etinye Java 16 (OpenJDK 16) na Rocky Linux

Dị ka ị pụrụ ịhụ, ị ​​pụrụ ịhụ na mbipute bụ ọhụrụ 16.0.2 na-ewu.

Na-anwale nwụnye Java

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 gbalịa iji ụwa Hello ama 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 16 (OpenJDK 16) na Rocky Linux

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 16 (OpenJDK 16) ụdị kachasị ọhụrụ, yana nbudata na ụdị n'ọdịnihu yana itinye otu usoro maka sistemụ arụmọrụ Rocky Linux 8 gị.

Ahapụ a Comment