Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

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-1.7.0.60-2.5.0.1.fc20.x86_64/jre/bin/java
 + 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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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