This is a newly installed CentOS 6.2 x86_64 I have downloaded java 8u5 RPM for GNU/Linux to run a .jar file, but I am unable to.

I have removed java through terminal through the command

rpm -e jar-1.8.0_05

and have attempted to reinstall it, though I still get the same error. I have also attempted to install java 7u60, but I still get the same error.

I am now on java 8u5, trying to find a fix for this.

java 7 or 8 required


Find out what version of java you are using:

$ java -version
openjdk version "1.8.0_05"
OpenJDK Runtime Environment (build 1.8.0_05-b13)
OpenJDK 64-Bit Server VM (build 25.5-b02, mixed mode)

If it's not the one you want, use the alternatives system as root to select the right one:

# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
*  1           /usr/lib/jvm/java-1.7.0-openjdk-
 + 2           /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number: 2

If you downloaded an RPM from the Oracle site, you probably don't have the relevant entries in the alternatives system. Create them. This is an example for an old 1.6, adapt it to your current version.

alternatives --install /usr/bin/java        java        /usr/java/jdk1.6.0_34/jre/bin/java 1634   \
         --slave   /usr/bin/appletviewer appletviewer /usr/java/jdk1.6.0_34/bin/appletviewer  \
         --slave   /usr/bin/apt         apt          /usr/java/jdk1.6.0_34/bin/apt  \
         --slave   /usr/bin/extcheck    extcheck     /usr/java/jdk1.6.0_34/bin/extcheck  \
         --slave   /usr/bin/idlj        idlj         /usr/java/jdk1.6.0_34/bin/idlj  \
         --slave   /usr/bin/jar         jar          /usr/java/jdk1.6.0_34/bin/jar  \
         --slave   /usr/bin/xjc         xjc          /usr/java/jdk1.6.0_34/bin/xjc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.