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
Though the question is about the error with Eclipse
setup but thought an answer of fixing this error with IntelliJ
and Windows 10 setup may also be helpful here.
1. Go to File
--> Settings
--> Build, Execution, Deployment
--> Build Tools
--> Maven
--> Importing
2. Set JDK
for Importer
as shown below to JAVA_HOME
Also JAVA_HOME
should be set to JDK
path at Environment Variables --> System variables and also add %JAVA_HOME%\bin
to Path System variables
I tried all of the above, however, still getting the same error message.
In my case an actual JRE was incorrectly used as JRE System Library in the project-specific build path which was obviously overriding all those other settings discussed here.
If that is so in your case try the following:
My answer pertains to the Eclipse in Windows environment.
I went to Preferences --> Java --> Installed JREs I did NOT see the JDK in here. I only saw the JRE here. So I added the JDK and then unchecked the JRE. Then checked JDK. Then I ran the POM file using Run Configurations. Choose the tab JRE and select the option "Workspace Default..." Here are the images
I was getting the same error when I created a new EC2 ubuntu 16.04 instance with Java already installed on it and while running mvn clean package, I encountered this issue and the below solution worked for me.
If you are working on an Ubuntu server, then you can try installing Java again and for that you can use this answer How to install the JDK on Ubuntu Linux
Problem statement = No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? intellij
Solution
Please set the Environment variable like below to solve the issue
Variable name : JAVA_HOME
Variable Value : C:\Program Files\Java\jdk1.8.0_202
Variable name : M2_HOME
Variable Value : C:\Program Files\apache-maven-3.6.0
Moreover, Add Java and maven path in "System Variables" like below:
C:\Program Files\Java\jdk1.8.0_202\bin
C:\Program Files\apache-maven-3.6.0\bin
Add new JRE definition (select path JDK), worked for me.
http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-add_new_jre.htm