0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

環境変数「JAVA_HOME」パス設定手順の備忘録

Posted at

環境変数「JAVA_HOME」のパス設定手順の備忘録

「JAVA_HOME」の設定手順を良く忘れがちなので、備忘録として示す。

環境

$ cat /etc/redhat-release 
CentOS Linux release 8.1.1911 (Core)

設定手順

JDKのパスを確認する。インストールされていなければ、JDKを適宜インストールしてください。

$ dirname $(readlink $(readlink $(which java)))
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el8_1.x86_64/jre/bin

JAVA_HOMEのパスを設定する。

$ cp -pi /etc/profile{,.org}
$ vi /etc/profile
$ diff /etc/profile{,.org}
86,90d85
< 
< export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el8_1.x86_64
< export PATH=$PATH:$JAVA_HOME/bin
< export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
<
$ source /etc/profile
$ echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el8_1.x86_64

以上

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?