mvn compile error.

Answered

[code]

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

[/code]

 

This is the output i get when i try to compile using the command in intellij

 

[code]

mvn clean package

[/code]

 

Where is it drawing the directory? I can compile java code no problem.

9 comments
Comment actions Permalink

JDK for Maven running in IntelliJ IDEA is configured here:

If you run Maven from the Terminal, JDK/Maven from the PATH will be used.

0
Comment actions Permalink

I set it to this in settings, restarted, allowed access due to firewall alert and tried running it in terminal. Still nothing.

 

i echoed %PATH% and this is what i got

C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\apache-maven-3.5.3\bin;

 

I verified that the directory is correct for apache maven. This is done within intellij terminal.

0
Comment actions Permalink

Terminal doesn't use any settings in IntelliJ IDEA, it uses the system PATH environment only for both Java and Maven paths.

0
Comment actions Permalink

so why am i still getting this compiling issue?

 

My path is correct, i set it to 1.8 as per your picture and yet im still getting a problem...

0
Comment actions Permalink

Most likely, `C:\Program Files (x86)\Common Files\Oracle\Java\javapath` points to JRE instead of JDK. Correct your PATH and make sure JDK is first in the list.

0
Comment actions Permalink

java path folder consists of java, javaw and javaws executables.

I put maven path in first like this..

 

C:\Program Files\apache-maven-3.5.3\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;

 

i tried running t in the main pom and im still getting the same issue.

0
Comment actions Permalink

> java path folder consists of java, javaw and javaws executables.

What is the version reported by these executables? You should install Oracle JDK and put it first in PATH instead. If there is no javac, it's JRE, not JDK.

0
Comment actions Permalink

I'm having the same problem. I've set the jdk for importer to my java 8 jdk, the same I use for compiling externally. (It defaults to a JRE!) I set the maven runner to the same thing.

When I open a terminal window, it defaults to java 12. But it should be using the ones in my settings. My project also specifies jdk 8 for both my project and my module language level. My pom.xml file specifies 1.8 for source and target in my maven compiler plug-in. I can't think of where else I should set this. (I have the latest release IntelliJ, 2019.3)

0
Comment actions Permalink

Terminal always uses JDK from PATH, not from your IDE project settings.

0

Please sign in to leave a comment.