Xaaf Code
Xaaf Code

Reputation: 43

No Compiler is provided in this environment

Before I start, let me tell you that I've been Googling for about an hour or two now, so please don't respond to this question saying "Hey! You know that there's plenty of answers on Google?"

Now to the question: whenever I run mvn clean package, I get the this error No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?. I've checked my Java versions, and these are the outputs.

Java JRE

java -version returned java version "1.8.0_181"

Java JDK

javac -version returned javac 1.8.0_181

Maven version

mvn -version returned

Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:14+02:00)
Maven home: C:\Program Files\Apache\maven
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jre1.8.0_181
Default locale: nl_NL, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

From what I found on Google, there should be a line saying Java Home or something followed by the JDK version and it's path. As you can see, It's not appearing here. I've tried setting the JAVA_HOME variable multiple times, and I verified that it works, by executing echo %JAVA_HOME, which returned it's proper path.

Any help?

EDIT Output of echo %JAVA_HOME%: C:\Program Files\Java\jdk1.8.0_181

System variables:

enter image description here

Upvotes: 2

Views: 1452

Answers (2)

ThimiraR
ThimiraR

Reputation: 187

I had the same issue('mvn clean install' was working on the cmd, but not in the Git Bash) and it was resolved by removing the following from the path variable in Environment variables

"C:\Program Files (x86)\Common Files\Oracle\Java\javapath"

Upvotes: 0

Yan Khonski
Yan Khonski

Reputation: 13083

Do you have JDK_HOME, JAVA_HOME and MAVEN_HOME environment variables set? As @Chris311 says in his comment echo %JAVA_HOME or set in Windows will show if the environment variables was set and set correctly.

set JAVA_HOME

And yes, JAVA_HOME should point to JDK, not a JRE. For example, for my Windows Machine, it is JAVA_HOME=C:\Program Files\Java\jdk1.8.0_181.

enter image description here

Update

As we figured out, it did not work in the git bash console, but it worked in the command line. I tested mvn clean package myself, it seemed to be working. However, some commands that work in cmd do not work in git bash, for example set java_home or cd to a path with \ (I needed to use /).

Upvotes: 1

Related Questions