리눅스에 자바 깔기

버전에 맞춰서 깐다.

https://openjdk.org/install/ 여기에 설치법이 있는데

JDK 9 & Later

Oracle's OpenJDK JDK binaries for Windows, macOS, and Linux are available on release-specific pages of jdk.java.net as .tar.gz or .zip archives.

As an example, the archives for JDK 13 may be found on jdk.java.net/13 and may be extracted on the command line using

$

or

$

depending on the archive type.

JDK 8

Debian, Ubuntu, etc.

On the command line, type:

$

The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.

Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.

On the command line, type:

$

The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.8.0-openjdk-devel package.

JDK 7

Debian, Ubuntu, etc.

On the command line, type:

$

The openjdk-7-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-7-jdk package.

Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.

On the command line, type:

$

The java-1.7.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.7.0-openjdk-devel package.

JDK 6

Debian, Ubuntu, etc.

On the command line, type:

$

The openjdk-6-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-6-jdk package.

Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.

On the command line, type:

$

The java-1.6.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.6.0-openjdk-devel package.

BSD Port

For a list of pointers to packages of the BSD Port for DragonFly BSD, FreeBSD, Mac OS X, NetBSD and OpenBSD, please see the BSD porting Project's wiki page.

이렇게 하는데 사실 8 이나 혹은 그 이후버전을 쓸테니까 저부분만 잘 보고 하면된다.

나는 부트라 17쓸거다. 근데 그냥 저 숫자만바꾸면 깔린다.

yum install -y java-17-openjdk

버전 조작하기

alternatives --config java

java 버전이 여러개 필요한경우는 가서 맞는 라인번호를 입력하면 되는데

가끔 커널에 여러가지 설정을 하다 보면 java Home경로가 안맞는 경우가 있다.

이럴때는 echo로 home경로를 임시로 주거나 java가 설치되어 있는 sys 아래에가서

확인해보면 여러가지 버전의 java 들이 같이 들어있을텐데 여기서찾아서

설정값을 넣어주면 해결된다.