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

后端 未结 30 2198
盖世英雄少女心
盖世英雄少女心 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:20

    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.

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

    I tried most of the answers without success. What worked for me was (after following https://stackoverflow.com/a/21279068/2408893):

    • right click on project -> Properties
    • select Java Build Path
    • select the JRE System Library
    • click edit
    • In execution environment select a jdk

    • click Finish
    • build and run
    0 讨论(0)
  • 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

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

    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.

    0 讨论(0)
  • 2020-11-22 16:24
    1. Set the JAVA_HOME environment variable to the JDK root folder - required if you run command line or maven (mvn).
      • (Search google for JAVA_HOME for more info)
    2. In project properties in section Java Compiler select required JDK - if you run directly from eclipse
    0 讨论(0)
  • 2020-11-22 16:24

    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...

    1. Uninstall all java versions from your computer
    2. Install JDK8 from here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

    3. Then define the JAVA_HOME system environmental value - tutorial here: https://docs.oracle.com/cd/E19509-01/820-3208/inst_cli_jdk_javahome_t/

    4. Restart Eclipse and enjoy! (at least that's what I did)

    Hoping this spares some poor wanderer of some trouble.

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