Java 17のインストール

(20)
https://techviewleo.com/install-java-openjdk-on-ubuntu-linux/


add-apt-repository ppa:linuxuprising/java
apt update
apt install oracle-java17-installer

update-alternatives --config java

java -version
javac -version

vi .profile
export JAVA_HOME="/usr/lib/jvm/java-17-oracle"
source .profile
echo $JAVA_HOME

cat > Hello_World.java <<EOF
public class helloworld {
  public static void main(String args) {
    System.out.println("Hello Java !");
  }
}
EOF

java Hello_World.java

 

  • Debian

(11)
https://computingforgeeks.com/install-oracle-java-openjdk-on-debian-linux/

apt update
apt-cache search openjdk | grep 17

apt install openjdk-17-jdk

update-alternatives --config java

java -version
javac -version

vi .profile
export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
source .profile
echo $JAVA_HOME

cat > Hello_World.java <<EOF
public class helloworld {
  public static void main(String args) {
    System.out.println("Hello Java !");
  }
}
EOF

java Hello_World.java

 

  • CentOS

(8)
https://techviewleo.com/install-java-openjdk-on-rocky-linux-centos/

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

alternatives --config java


java -version
javac -version

vim .bash_profile
export JAVA_HOME="/usr/java/default"
source .bash_profile
echo $JAVA_HOME


cat > Hello_World.java <<EOF
public class helloworld {
  public static void main(String args) {
    System.out.println("Hello Java !");
  }
}
EOF

java Hello_World.java

  • Windows Server

(2019)
https://www.oracle.com/java/technologies/downloads/#jdk17-windows
https://www.whyit.work/entry/2018/07/09/171632

java -version
javac -version

[Environment]::SetEnvironmentVariable('JAVA_HOME', 'C:\Program Files\Java\jdk-17.0.1', 'User')
get-childitem env:JAVA_HOME

 

notepad Hello_World.java
public class helloworld {
  public static void main(String args) {
    System.out.println("Hello Java !");
  }
}

java Hello_World.java