0

Getting the following error while compiling the Maven Project:

    Warning: JAVA_HOME environment variable is not set.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building traccar 4.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-checkstyle-plugin:3.0.0:check (checkstyle) @ traccar ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-bytecode-version) @ trac                                                                                        car ---
[WARNING] Invalid bytecodeVersion for module-info.class: expected 52, but was 53
[WARNING] Invalid bytecodeVersion for module-info.class: expected 52, but was 53
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ traccar ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ traccar ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 674 source files to /home/csl/traccar/traccar-master/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.471s
[INFO] Finished at: Thu Feb 14 14:35:38 BDT 2019
[INFO] Final Memory: 86M/582M

=>I have my Java Home setup correctly and Maven installed, I have surfed the web and found few solutions but nothing is working for me!

:~$ echo $JAVA_HOME
/usr/lib/jvm/jdk1.7.0_75

:~$ which javac
/usr/lib/jvm/jdk1.7.0_75/bin/javac

:~$ mvn -v
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.7.0_75/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-31-generic", arch: "amd64", family: "unix"

:~$ java -version
java version "1.7.0_181"
OpenJDK Runtime Environment (IcedTea 2.6.14) (7u181-2.6.14-0ubuntu0.3)
OpenJDK 64-Bit Server VM (build 24.181-b01, mixed mode)

s:~$ javac -version
javac 1.7.0_75
:~$

Would be grateful for the solution.

Thanks

Hasan
  • 53
  • 10
  • you can take a look here: https://stackoverflow.com/questions/19655184/no-compiler-is-provided-in-this-environment-perhaps-you-are-running-on-a-jre-ra – Sorin Penteleiciuc Feb 14 '19 at 09:20

1 Answers1

0

It says in the Error Message that probably "you are running on a JRE rather than a JDK". And when you run $mvn -v then you get Java home: /usr/lib/jvm/jdk1.7.0_75/jre So you might change it to the JDK like in this issue (No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?)

I hope it helps.

Malte Kölle
  • 192
  • 1
  • 11
  • The application is on a server, I am trying to compile in CMD. Using IDE (NetBeans) I am able to run the application. – Hasan Feb 14 '19 at 09:32