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

后端 未结 30 2201
盖世英雄少女心
盖世英雄少女心 2020-11-22 15:40

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         


        
相关标签:
30条回答
  • 2020-11-22 16:11

    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

    0 讨论(0)
  • 2020-11-22 16:12

    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:

    1. Open the project-specific libraries of the Java Build Path: Right-click "Project > Build Path > Configure Build Path..." and select "Libraries" tab.
    2. Select the "JRE System Library" entry and hit "Remove".
    3. Hit "Add Library...".
    4. A wizard pops up. Select "JRE System Library" and hit "Next >".
    5. Now select the correct JDK (in my case "Workspace default JRE", which I configured using a JDK).
    6. Close wizard by hitting "Finish".
    7. Close "Properties" dialog by hitting "OK".
    0 讨论(0)
  • 2020-11-22 16:17

    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

    0 讨论(0)
  • 2020-11-22 16:17

    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

    0 讨论(0)
  • 2020-11-22 16:19

    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:

    1. C:\Program Files\Java\jdk1.8.0_202\bin

    2. C:\Program Files\apache-maven-3.6.0\bin

    0 讨论(0)
  • 2020-11-22 16:19

    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

    0 讨论(0)
提交回复
热议问题