[CentOS8] Since the javac command could not be used, install the java development environment.

The java command originally included version 1.8 and I could use it, but I couldn't compile it.

First, install openjdk.


# su
# yum -y install java-14-openjdk-devel

With this alone, javac can be used. Looking for the body of javac


# which javac
/usr/bin/javac

The body of / usr / bin / javac is / usr / lib / jvm / java-14-openjdk-14.0.2.12-1.rolling.el8.x86_64 / bin / javac. A symbolic link was automatically created in / usr / bin / that is in the path.

Next, upgrade the java command. Looking for where the java command is


# which java
/usr/bin/java

This should also have a separate entity,


# ll /usr/bin/java
lrwxrwxrwx.1 root root 22 October 24 11:28 /usr/bin/java -> /etc/alternatives/java
# ll /etc/alternatives/java
lrwxrwxrwx.1 root root 73 October 24 11:28 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-0.el8_2.x86_64/jre/bin/java

So that's it. It seems that you should change the link destination of / etc / alternatives / java. But where should I choose? Look for the java command.


# ll /usr/lib/jvm/*/bin/java
-rwxr-xr-x.1 root root 16056 July 23 21:21 /usr/lib/jvm/java-14-openjdk-14.0.2.12-1.rolling.el8.x86_64/bin/java
-rwxr-xr-x.1 root root 16056 July 23 21:21 /usr/lib/jvm/java-14-openjdk/bin/java
-rwxr-xr-x.1 root root 16056 July 23 21:21 /usr/lib/jvm/java-14/bin/java
-rwxr-xr-x.1 root root 16056 July 23 21:21 /usr/lib/jvm/java-openjdk/bin/java
-rwxr-xr-x.1 root root 16056 July 23 21:21 /usr/lib/jvm/java/bin/java
-rwxr-xr-x.1 root root 11680 September 10 01:49 /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.265.b01-0.el8_2.x86_64/bin/java
-rwxr-xr-x.1 root root 11680 September 10 01:49 /usr/lib/jvm/jre-1.8.0-openjdk/bin/java
-rwxr-xr-x.1 root root 11680 September 10 01:49 /usr/lib/jvm/jre-1.8.0/bin/java
-rwxr-xr-x.1 root root 16056 July 23 21:21 /usr/lib/jvm/jre-14-openjdk-14.0.2.12-1.rolling.el8.x86_64/bin/java
-rwxr-xr-x.1 root root 16056 July 23 21:21 /usr/lib/jvm/jre-14-openjdk/bin/java
-rwxr-xr-x.1 root root 16056 July 23 21:21 /usr/lib/jvm/jre-14/bin/java
-rwxr-xr-x.1 root root 11680 September 10 01:49 /usr/lib/jvm/jre-openjdk/bin/java
-rwxr-xr-x.1 root root 11680 September 10 01:49 /usr/lib/jvm/jre/bin/java

I don't know what to do, so I'll just use / usr / lib / jvm / java-14-openjdk / bin / java.


# ln -fs /usr/lib/jvm/java-14-openjdk/bin/java /etc/alternatives/java

Now you can run programs written in java. that's all.

Recommended Posts

[CentOS8] Since the javac command could not be used, install the java development environment.
The case that @Autowired could not be used in JUnit5
Java passes at the command prompt, but javac does not
About the current development environment (Java 8)
Install Java development environment on Mac
The story that the Servlet could not be loaded in the Java Web application
About the case that ("b" .. "aa") could not be used in Ruby Range
[Beginner] Install java development tool in cloud9 development environment.
Java development environment
Solved the problem that the test could not be executed from the command line with spring-boot-starter-test
Java development environment construction on Mac-JDK Install (2020 preservation version)
[Java] When var should be used and when it should not be used
The story that the forced update could not be implemented
[Java] Coverage report could not be created with the combination of default method of Cobertura + interface
Java development environment memo
java development environment construction
The mysterious java.exe was the reason why javac and java versions could not be matched no matter how many times I tried.
Java 14 new features that could be used to write code
[Development log ⑬] Do not let 0 be entered in the form !!
[Java development environment construction] Install OpenJDK 11 (Java 11) on macOS with Homebrew.