LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to find OpenJDK installation directory ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-find-openjdk-installation-directory-4175629309/)

Volcano 05-09-2018 02:09 AM

How to find OpenJDK installation directory ?
 
I'm using AWS Amazon EC2 linux.


Problem : How to find OpenJDK installation directory ?


Background:

when I do java -version ... it shows java 1.7 installed.

I want to find where this java installed.

I need this because I'd like to set JAVA_HOME environment variable.

JAVA_HOME = <installation directory >


Could you please help to find OpenJDK installation directory ?

pan64 05-09-2018 03:56 AM

Code:

% which java
/usr/bin/java
 % readlink -f /usr/bin/java
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java


jsbjsb001 05-09-2018 04:07 AM

Quote:

Originally Posted by Volcano (Post 5852350)
I'm using AWS Amazon EC2 linux.

Problem : How to find OpenJDK installation directory ?

Background:

when I do java -version ... it shows java 1.7 installed.
I want to find where this java installed.
I need this because I'd like to set JAVA_HOME environment variable.
JAVA_HOME = <installation directory >
Could you please help to find OpenJDK installation directory ?

Given that AWS Amazon EC2 Linux seems to use yum, it would therefore use RPM software packages, so there's at least a couple of ways you can find out. Note: This will only be true if you have installed java via software packages - which you should be doing.

1. Use the repoquery command to do it;

First find out what java packages you have installed:

Code:

yum info java*
Then

Code:

repoquery --list <name of package>
or

2. Use the rpm command instead;

Code:

rpm -ql <name of package>
Look for lines that have "bin" in them, that's probably the folder path you are looking for.

See this for more information.


All times are GMT -5. The time now is 11:20 PM.