0

I am trying to generate a build using maven, So started with mvn clean package command in linux server and Getting error as follows:

No compiler is provided in this environment. Perhaps you are running on a JRE rather than
a JDK?

I searched and found some solutions so changed my JAVA_HOME path etc. And following is my settings

  • My JAVA_HOME => /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/jre
  • MVN VERSION SHOWS: Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
  • Maven home: /home/ec2-user/.sdkman/candidates/maven/current
  • Java version: 1.7.0_131, vendor: Oracle Corporation
  • Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/jre
  • OS name: "linux", version: "4.4.51-40.58.amzn1.x86_64", arch: "amd64", family: "unix"**

MY POM.XML File as follows: enter image description here

Cœur
  • 32,421
  • 21
  • 173
  • 232
AnNaMaLaI
  • 3,966
  • 8
  • 50
  • 91

1 Answers1

2

My JAVA_HOME => /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/jre

By this I assume you mean setting an environmental variable. Mine is set to the directory right above yours. I'd try that.

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64

Mine is set like the following which may not work for you but is here as an example:

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64

When I ls that directory I get the following. You should get something similar.

$ ls /usr/lib/jvm/java-7-openjdk-amd64
ASSEMBLY_EXCEPTION  docs     jre  man      THIRD_PARTY_README
bin                 include  lib  src.zip
Gray
  • 108,756
  • 21
  • 270
  • 333
  • Thanks [~gray] and [~satya] I installed the JDK and Eventually it works. – AnNaMaLaI Mar 23 '17 at 04:25
  • Tested on CentOS 6.5. sudo yum install java-1.7.0-openjdk.x86_64 installs only JRE(javac will be absent). sudo yum install java-1.7.0-openjdk-devel installs JDK. from http://stackoverflow.com/a/12792019/744478 – AnNaMaLaI Mar 23 '17 at 04:25