I\'m compiling a project in Eclipse using m2eclipse. I set the JDK path in Eclipse like this:
Windows-->preferences-->installed jres--> jdk1.7.xx p
An alternative if jaipster's answer does not work is to go to:
Window > Preferences > Java > Installed JREs
Then to edit the jre so that it points to the jdk and not the jre (the jre home filed in the jre package editor)
That worked for me.
I tried most of the answers without success. What worked for me was (after following https://stackoverflow.com/a/21279068/2408893):
i faced the same issue, the mistake i made was i added jre path only in the path var,not jdk path .When jdk path was added to path and build the maven project its working perfect .Thanks all
In my case I had system variable path has "C:\ProgramData\Oracle\Java\javapath" location.
In "C:\ProgramData\Oracle\Java\javapath" location java, javaw only there. So I am getting the same error.
Once I removed all files in "C:\ProgramData\Oracle\Java\javapath" folder my error got resolved.
JAVA_HOME
environment variable to the JDK root folder - required if you run command line or maven (mvn
).
JAVA_HOME
for more info)I just wasted 3 hours with this problem until I managed to make it work. I had this error in the Eclipse Terminal when issuing a mvn compile command:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
So I read here that I have to make a new system variable called JAVA_HOME and make it point towards the jdk installation folder. However this generated another error:
Source option 1.5 is no longer supported. Use 1.6 or later
Couldn't find a fix for this one so...
So the fix to make it all go away is install Java SE Development Kit 8! I was using 9 thinking that if it's the latest it must be better...
Anyway...
Install JDK8 from here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Then define the JAVA_HOME system environmental value - tutorial here: https://docs.oracle.com/cd/E19509-01/820-3208/inst_cli_jdk_javahome_t/
Restart Eclipse and enjoy! (at least that's what I did)
Hoping this spares some poor wanderer of some trouble.