How to find if you don't know the Java installation directory

I lost track of the installation directory on the server for various reasons.

Method 1: View the environment variable JAVA_HOME

This is OK if you are using the version you are currently using (the version that works with the java command).

$ printenv JAVA_HOME
/usr/java/default

Method 2: Look at the environment variable PATH

If the version you are currently using (the version that works with the java command) does not have JAVA_HOME, this is OK.

$ printenv PATH | sed -e 's/:/:\n/g' | grep java
/usr/java/default/bin:

Method 3: Search by package name installed with yum

It's common to have multiple versions installed. When you want to find a version of Java that is not set to JAVA_HOME.

Reference: Check the installation location of packages installed with yum-I have never worked hard when I was a student

#Check installed packages from version
$ yum list installed | grep java-1.7
java-1.7.0-openjdk.x86_64  1:1.7.0.151-2.6.11.0.el6_9
java-1.7.0-openjdk-devel.x86_64

#Check the installation directory
$ rpm -ql java-1.7.0-openjdk-devel.x86_64 | grep bin
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151.x86_64/bin
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.151.x86_64/bin/appletviewer
...abridgement...

Recommended Posts

How to find if you don't know the Java installation directory
If you don't know it, it's dangerous. Carefully explain how to use the xargs command
How to know the current directory in Python in Blender
If you don't know how to draw the graph you want with matplotlib, it is convenient to look at the gallery.
If you don't know how many arguments you will have 2 ** kwargs Variadic arguments
How to find the area of the Voronoi diagram
When you don't know the SCP when you port forward
How to find the correlation for categorical variables
python I don't know how to get the printer name that I usually use.
[Reintroduction to python] How to import via the parent directory
How much do you know the basics of Python?
How to find the optimal number of clusters in k-means
[python] How to check if the Key exists in the dictionary
How to return to the previous directory with the Bash cd command
I didn't know how to use the [python] for statement
How to find the scaling factor of a biorthogonal wavelet
If you want your colleagues to use the same language
How to use the generator
How to use the decorator
How to increase the axis
How to start the program
Don't write Python if you want to speed it up with Python
How to implement Java code in the background of RedHat (LinuxONE)
How to know the internal structure of an object in Python
If you remove the list to be looped, you will get terrible.
I tried to find out as much as possible about the GIL that you should know if you are doing parallel processing with Python
I want to know if you install Python on Mac ・ Iroha
How to get the directory where the EXE built with Pyinstaller exists
How to find the memory address of a Pandas dataframe value
I don't know how to get query parameters on GAE / P
Indispensable if you use Python! How to use Numpy to speed up operations!
What to do if you can't use the trash in Lubuntu 18.04.
[AtCoder] How to find the binomial coefficient nCk mod.p [D --Knight]
How to display bytes in the same way in Java and Python
For Python beginners. You may be confused if you don't know the general term of the programming language Collection.
How to automatically check if the code you wrote in Google Colaboratory corresponds to the python coding standard "pep8"
How to calculate the autocorrelation coefficient
How to use the zip function
EP5 Know How to Slice Sequences
How to use the optparse module
How to read the SNLI dataset
[Python] How to import the library
Don't you know it? pip command
How to overwrite the output to the console
If you ride the Titanic ... die.
I don't know the value error
What to do if you can't find well with grep's -f option
What to do if you can't find PDO in Laravel or CakePHP
How to find out the number of CPUs without using the sar command
If you want to include awsebcli with CircleCI, specify the python version
Python Note: When you want to know the attributes of an object
How to compare if the contents of the objects in scipy.sparse.csr_matrix are the same
What to do if you get stuck during Anaconda installation on Linux
If you feel that you can't find the Object Inspector in recent Spyder
A shell script to make sure you don't forget the pipenv shell again
Isn't Qt the strongest library if you want to easily output SVG?