0

Last week I installed Oracle Java 8 with the following commands:

sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Everything seemed to be fine (I continued using my system as normal, can't say exactly what I did over the week). Now, when I execute java -version I get

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

However, now when I execute javac -version I get

/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar: invalid LOC header (bad signature)
Exception in thread "main" java.lang.NoClassDefFoundError: javax/annotation/processing/ProcessingEnvironment
    at com.sun.tools.javac.Main.compile(Main.java:54)
    at com.sun.tools.javac.Main.main(Main.java:42)
Caused by: java.lang.ClassNotFoundException: javax.annotation.processing.ProcessingEnvironment
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 2 more

I guess there is some issue with rt.jar? What is the best way to proceed here? Should I try uninstalling/reinstalling Java 8? If so, what's the easiest way to do that? Or is there some Java component I'm missing? I want to develop Java programs in Eclipse, and it was my understanding that oracle-java8-installer would give me everything I need.

Can someone tell me what is included in "Oracle Java 8"? I know there are lots of Java things I could install, e.g. the JDK, JVM... what are each of these things used for, and am I getting all of the when I install Java 8?

  • 1
    rt.jar is probably corrupt. You can try reinstalling with sudo rm /var/cache/oracle-jdk8-installer/*.tar.gz; sudo apt-get install --reinstall oracle-java8-installer – Chai T. Rex Jan 9 '17 at 8:17
2

rt.jar is corrupt.

Remove the possibly-corrupt Java installer:

sudo rm /var/cache/oracle-jdk8-installer/*.tar.gz

Then reinstall:

sudo apt-get install --reinstall oracle-java8-installer
  • Any idea how it could have been corrupted? – Adam Jan 9 '17 at 20:16
  • Most likely a problem while being downloaded. – user589808 Jan 9 '17 at 20:18
  • It was working before. The only thing I can think of that might have had an effect is that I installed and removed Eclipse a couple times. – Adam Jan 9 '17 at 20:20
  • If it was the one from their website, as recommended (Ubuntu's repo version is quite old), it might. Haven't seen it happen before though. – user589808 Jan 9 '17 at 20:33

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.