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

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

    I faced the same issue while trying to build a jar file of my project application using mvn clean install, though the application was working fine while running from Eclipse.

    The issue was, indeed too naive, that I had not set the JAVA_HOME environment variable. All I had to do is set JAVA_HOME environment variable to JDK directory, make sure it is not till "\bin" and without semi-colon ";".

    How I understood it is as:

    The application worked fine in Eclipse as JRE System Library was referring to JRE inside the JDK folder instead of external JRE folder without JDK. [As explained very well in other answers]

    This configuration does not apply to maven command that we run on command prompt. It will still look for JAVA_HOME variable to access the JRE System library and when it is not found it refers to external JRE folder without JDK.

提交回复
热议问题