Eclipse/Maven error: “No compiler is provided in this environment”

前端 未结 24 1313
庸人自扰
庸人自扰 2020-11-27 04:36

I am a relative newcomer to the world of Java enterprise development. My organization\'s Java guru is out on indefinite family leave, and I have been assigned the task of m

相关标签:
24条回答
  • 2020-11-27 05:08
    1. Uninstall older Java(JDK/JRE) from the system( Keep one (latest) java version), Also remove if any old java jre/jdk entries in environment variables PATH/CLASSPATH
    2. Eclipse->Window->Preferences->Installed JREs->Add/Edit JDK from the latest installation
    3. Eclipse->Window->Preferences->Installed JREs->Execution Environment->Select the desired java version on left and click the check box on right
    4. If you are using maven include the following tag in pom.xml (update versions as needed) inside plugins tag.

      <plugin>  
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.1</version>
              <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
              </configuration>
          </plugin>
      
    5. Right click on eclipse project Maven - > Update Project
    0 讨论(0)
  • 2020-11-27 05:08

    For me (on windows 10), I was getting the error "No compiler is provided in this environment" at the Windows command prompt when I ran mvn install. The fix was changing the JAVA_HOME environment variable to point to my jdk (C:\Program Files\Java\jdk1.8.0_101); previously it had pointed to the jre.

    And to get Eclipse to use the new jdk, I edited eclipse.ini in my eclipse distribution and changed the line for -vm to C:\Program Files\Java\jdk1.8.0_101\bin.

    0 讨论(0)
  • 2020-11-27 05:09

    This worked for me. 1. Click on Window-> Preferences -> Installed JRE. 2. Check if you reference is for JDK as shown in the image below.

    If not, Click on Add-> Standard VM -> Give the JDK path by selecting the directory and click on finish as shown in the image

    1. Last step, click on Installed JREs -> Execution Environments -> select your JDE as shown in the image below

    2. Maven -> Clean

    0 讨论(0)
  • 2020-11-27 05:09

    if someone is running Eclipse in Ubuntu and have this problem I have found the answer by following these steps:

    1. Eclipse->window->preference.
    2. Select installed JREs->Add
    3. Select standardVM.
    4. JRE home: press [Directory..] button.
    5. Choose your java (my problem was my eclipse was running with java8 and my VM were with java7), in my case java8 was installed in usr/local/jvm/java-8-oracle.
    6. Press finish.
    7. Then press installed JRES arrow so you can see the other options.
    8. Go to Execution Environment.
    9. Select JavaSE-1.6 on left and in the right (the compatible JRE) you have to choose the Java you have just installed( in my case java-8-oracle). you have to do this steps with JavaSE1.8.
    10. Click OK and restart Eclipse.
    0 讨论(0)
  • 2020-11-27 05:09

    Installed JRE In my case I solved the problem by removing duplicates of names, I kept only one with the name: jdk.1.8.0_101

    0 讨论(0)
  • 2020-11-27 05:10

    Screen_shot Add 'tools.jar' to installed JRE.

    1. Eclipse -> window -> preference.
    2. Select installed JREs -> Edit
    3. Add External Jars
    4. select tools.jar from java/JDKx.x/lib folder.
    5. Click Finish
    0 讨论(0)
提交回复
热议问题