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

前端 未结 24 1314
庸人自扰
庸人自扰 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:11

    Please check if you have the following entries in the element of your pom.xml especially the jdk.version because switching to an installed jre did not fix me the similar error.

    <properties>
        <jdk.version>1.7</jdk.version>
        <spring.version>4.1.1.RELEASE</spring.version>
        <jstl.version>1.2</jstl.version>
        <junit.version>4.11</junit.version>
    </properties>
    
    0 讨论(0)
  • 2020-11-27 05:11

    Follow : Windows --> Preferences --> Java ---> Installed JREs

    SampleImage

    Click on "Search.."

    Navigate to C drive ---> Program files

    Sample Image 2

    Eclipse will find all the jre's and jdk's --> select one of the jdk and select Apply

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

    Maven requires JDK to compile. In Eclipse you need to CHANGE/ REPLACE your JRE to the JDK path that your JAVA_HOME points to. Navigate to Window > Preferences > Java > Installed JREs.

    Make sure that the maven-compiler-plugin in you pom.xml has the source and target of the java version in your JAVA_HOME

    http://learn-automation.com/maven-no-compiler-is-provided-in-this-environment-selenium/

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

    Go to Window → Preferences → Java → Installed JREs.

    And see if there is an entry pointing to your JDK path, and if not, click on Edit button and put the path you configured your JAVA_HOME environment.

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

    I also faced similar error when I was working with Jdk1.8_92. For me, I found tools.jar was missing in my jdk folder. Since I was running in console, I couldn't try the options of eclipse suggested by others..

    I installed jdk-8u92-windows-x64. After I tried all options, I observed that tools.jar was missing in jdk1.8.0_92/lib folder. I copied tools.jar from my older version of java. Then It was able to compile.

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

    When I was runing mvn compile, I was getting below error in console:

    [INFO] Changes detected - recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
    [INFO] Compiling 1087 source files to C:\Code\DevVNextComplete\Development_vNext\Source\JARS\target\classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR :
    [INFO] -------------------------------------------------------------
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [INFO] 1 error
    

    [Resolution]

    I had added, the JAVA_HOME variable in my environment variables and then it worked.

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