Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check java version at linux (RedHat6)

Tags:

java

linux

enter image description here I am trying to check what java version I have installed in my linux machine, I have tried:

which java 

and I get:

/usr/bin/java 

but when I type:

java -version 

the console is returning nothing and getting stuck in a "java mode" , feels like the command called java and its waiting for my inputs, any thing I type then returns nothing... until I type crt+C it exits the mode...

like image 882
Atheel Massalha Avatar asked Dec 04 '17 05:12

Atheel Massalha


People also ask

How do I know if Java is installed on redhat?

To check which version of Java is installed, follow this procedure: -Open a Linux command prompt. -Enter the command java -version. -If Java version is installed on your system, you see a Java installed response. Check the version number in the message.

How do I know if Java is running on Linux?

On Linux, you can view processes with the ps command. It is the simplest way to view the running processes on your system. You can use the ps command to view running Java processes on a system also by piping output to grep .

How do I know where Java is installed on Linux?

This depends a bit from your package system ... if the java command works, you can type readlink -f $(which java) to find the location of the java command. On the OpenSUSE system I'm on now it returns /usr/lib64/jvm/java-1.6. 0-openjdk-1.6. 0/jre/bin/java (but this is not a system which uses apt-get ).


2 Answers

If your java version more than 1.6 then it should work

java -version

if version is not installed it returns error message

Please share some snapshot so i can rectify it

like image 172
iamsankalp89 Avatar answered Oct 24 '22 03:10

iamsankalp89


To answer your question directly, you can use

rpm -qi java

OR

yum info "java"

For future Referenecs . You can try any of these commands.

rpm -qi "package_name_without_quotes"

It gives information of installed package. To display information about one or more packages (glob expressions are valid here as well), use the following command :

yum info "package_name_without quotes"

OR

yum list "package_name_without_quotes"

OR

yum --showduplicates list "package_name_without_quotes"

The yum info package_name command is similar to the rpm -q --info package_name command, but provides as additional information the ID of the Yum repository the RPM package is found in.

You can also query the Yum database for alternative and useful information about a package by using the following command :

yumdb info "package_name_without_quotes"

This command provides additional information about a package, including the check sum of the package (and algorithm used to produce it, such as SHA-256), the command given on the command line that was invoked to install the package (if any), and the reason that the package is installed on the system.

like image 2
C0deDaedalus Avatar answered Oct 24 '22 03:10

C0deDaedalus