Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get java path in CentOS?

Tags:

java

path

centos7

I need to configure my Jenkins Server and I need to add Java path to Jenkins configuration.

yum install java-1.8.0-openjdk

However I'm new to lunix command, any suggestion please?

I dont know where yum install it!

See the validated answer!

like image 893
Naou Avatar asked Oct 13 '15 14:10

Naou


2 Answers

try this if java command works

readlink -f $(which java)
like image 65
Pravin Bansal Avatar answered Sep 21 '22 13:09

Pravin Bansal


They usually reside in /usr/lib/jvm. You can list them via ll /usr/lib/jvm. The value you need to enter in the field JAVA_HOME in jenkins is /usr/lib/jvm/java-1.8.0-openjdk.

Update

when I look at '/usr/lib/jvm' I get ...

What you see there is a list of symbolic links pointing to a similar target located in /etc/alternatives. In the end they all point to the same target. The difference is only the name which allows you to choose how explicit your choice if the target version shall be.

(Because java-1.8.0-openjdk is missing: Maybe you also need to install the package java-1.8.0-openjdk-devel.)

like image 23
thomas.mc.work Avatar answered Sep 22 '22 13:09

thomas.mc.work