Invalid Java installation: No version could be obtained

Hi ,
i am in mid of upgrading one of the java based application which requires higher version of java 1.8 from java 1.6, I have updated bash_profile and required environment variable correctly but still application unable to obtain the required version of java 1.8.

here is my environment detail

echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/oraclient/app/oracli/product/11.2.0/client_1/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64
echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64

but still application unable to find the java version as per below error

Java Home Directory (Must point to Java 1.8 directory) (DEFAULT:
   /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/): /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/

Java Home Directory (Must point to Java 1.8 directory):
Invalid Java installation: No version could be obtained

Please find the below directory structure :
Please find the below java directory structure

$cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/

 java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64]$ls -lrt
total 50728
-rw-r--r--  1 root root 51935439 Jan 16  2017 src.zip
drwxr-xr-x  4 root root       26 Feb  8  2017 jre
drwxr-xr-x  2 root root     4096 Feb  8  2017 bin
drwxr-xr-x  3 root root      125 Feb  8  2017 include
drwxr-xr-x  3 root root      135 Feb  8  2017 lib
drwxr-xr-x  2 root root     4096 Feb  8  2017 tapset
drwxr-xr-x 10 root root      125 Feb  8  2017 demo
drwxr-xr-x 11 root root      152 Feb  8  2017 sample

java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64]$cd bin/

ls -lrt
total 420
-rwxr-xr-x 1 root root   2806 Jan 16  2017 java-rmi.cgi
-rwxr-xr-x 1 root root   7384 Jan 16  2017 xjc
-rwxr-xr-x 1 root root   7392 Jan 16  2017 wsimport
-rwxr-xr-x 1 root root   7384 Jan 16  2017 wsgen
-rwxr-xr-x 1 root root 103424 Jan 16  2017 unpack200
-rwxr-xr-x 1 root root   7464 Jan 16  2017 tnameserv
-rwxr-xr-x 1 root root   7392 Jan 16  2017 servertool
-rwxr-xr-x 1 root root   7392 Jan 16  2017 serialver
-rwxr-xr-x 1 root root   7392 Jan 16  2017 schemagen
-rwxr-xr-x 1 root root   7392 Jan 16  2017 rmiregistry
-rwxr-xr-x 1 root root   7384 Jan 16  2017 rmid
-rwxr-xr-x 1 root root   7384 Jan 16  2017 rmic
-rwxr-xr-x 1 root root   7400 Jan 16  2017 policytool
-rwxr-xr-x 1 root root   7392 Jan 16  2017 pack200
-rwxr-xr-x 1 root root   7456 Jan 16  2017 orbd
-rwxr-xr-x 1 root root   7400 Jan 16  2017 native2ascii
-rwxr-xr-x 1 root root   7392 Jan 16  2017 keytool
-rwxr-xr-x 1 root root   7384 Jan 16  2017 jstatd
-rwxr-xr-x 1 root root   7384 Jan 16  2017 jstat
-rwxr-xr-x 1 root root   7456 Jan 16  2017 jstack
-rwxr-xr-x 1 root root   7408 Jan 16  2017 jsadebugd
-rwxr-xr-x 1 root root   7392 Jan 16  2017 jrunscript
-rwxr-xr-x 1 root root   7384 Jan 16  2017 jps
-rwxr-xr-x 1 root root   7448 Jan 16  2017 jmap
-rwxr-xr-x 1 root root   7384 Jan 16  2017 jjs
-rwxr-xr-x 1 root root   7448 Jan 16  2017 jinfo
-rwxr-xr-x 1 root root   7384 Jan 16  2017 jhat
-rwxr-xr-x 1 root root   7384 Jan 16  2017 jdeps
-rwxr-xr-x 1 root root   7400 Jan 16  2017 jdb
-rwxr-xr-x 1 root root   7408 Jan 16  2017 jconsole
-rwxr-xr-x 1 root root   7384 Jan 16  2017 jcmd
-rwxr-xr-x 1 root root   7384 Jan 16  2017 javap
-rwxr-xr-x 1 root root   7384 Jan 16  2017 javah
-rwxr-xr-x 1 root root   7392 Jan 16  2017 javadoc
-rwxr-xr-x 1 root root   7384 Jan 16  2017 javac
-rwxr-xr-x 1 root root   7336 Jan 16  2017 java
-rwxr-xr-x 1 root root   7392 Jan 16  2017 jarsigner
-rwxr-xr-x 1 root root   7384 Jan 16  2017 jar
-rwxr-xr-x 1 root root   7384 Jan 16  2017 idlj
-rwxr-xr-x 1 root root   7392 Jan 16  2017 extcheck
-rwxr-xr-x 1 root root   7400 Jan 16  2017 appletviewer

$cd java
java          javac         javadoc       javah         javap         java-rmi.cgi

anything else needs to setup, how application unable to find the java version though it is there.

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/bin/java

 bin]#pwd
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/bin

 bin]#java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

Check your application documentation to see where it expects to find Java.

Many Java applications expect Java to be located in a specific directory, for example '/usr/java', '/usr/bin/java', or wherever.

If you (for example):

# ls -l /usr/java

it will show you that this directory is symbolically linked to the actual Java directory, V1.6, V1.8, or whatever.

When you installed 1.8 the 1.6 directory was not removed so you have two versions to choose from. You might well need to change the link from the 1.6 directory to point to the 1.8 directory.

Many applications do not utilise $JAVA_HOME but expect to find Java in a specific directory. Find out from the application documentation what path that is.

---------- Post updated at 10:24 PM ---------- Previous update was at 10:19 PM ----------

Another thought is, does the application definitely need 64-bit Java or is it looking for 32-bit Java?

---------- Post updated at 10:25 PM ---------- Previous update was at 10:24 PM ----------

Perhaps you ought to post your hardware type, OS and version

1 Like

Thanks , Application required oracle JDK not openjdk .
issue resolved already.