Failed to initialize compiler: object java.lang.Object in compiler mirror not found

Using the Java 8 version of OpenJDK resolved this issue for me.

sudo update-alternatives --config java
sudo update-alternatives --config javac

This issue appears to be with Java 9 and gets solved with Java 8.

If you have Java 8 and Java 9, and you would like to keep both, you can set your environment variable JAVA_HOME to the Java 8 path.

For example:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home

You will need to replace jdk1.8.0_161.jdk with whichever version of the JDK that you have.

You can find that version with:

ls /Library/Java/JavaVirtualMachines/

Once you set that environment variable, you can open a new terminal and run java -version to see if the version was set correctly.

EDIT:

It may be worth noting that I have a Mac even though this is a linux question.


Installing java version "1.8.0_144" resolved the issue for me. I had installed jdk 1.9 previously.

Tags:

Ubuntu

Scala