Maven error :Perhaps you are running on a JRE rather than a JDK?

I’ve been facing the same issue with java 8 (ubuntu 16.04), trying to compile using mvn command line.

I verified my $JAVA_HOME, java -version and mvn -version. Everything seems to be okay pointing to /usr/lib/jvm/java-8-openjdk-amd64.

It appears that java-8-openjdk-amd64 is not completly installed by default and only contains the JRE (despite its name “jdk”).

Re-installing the JDK did the trick.

sudo apt-get install openjdk-8-jdk

Then some new files and new folders are added to /usr/lib/jvm/java-8-openjdk-amd64 and mvn is able to compile again.

Leave a Comment