Maven pointing to JRE instead of jdk

前端 未结 7 1840
南笙
南笙 2020-12-10 11:46

I\'ve been working with a co-worker on a problem I have been experiencing on a new project I just joined. Long story short, maven isn\'t building my .war file correctly. W

相关标签:
7条回答
  • 2020-12-10 12:14

    In Eclipse, Window>Preferences>Java>Installed JREs> make sure jdk is present and selected.

    If jdk and jre both are present, then delete jre from Installed JREs.

    0 讨论(0)
  • 2020-12-10 12:14

    You can modify it on this window:

    0 讨论(0)
  • 2020-12-10 12:30

    You can replace the environment from jre to jdk in Eclipse IDE as follows if it also shows compiler unavailable :

    • (right-click) your_project_name > Build Path > Configure Build Path > Libraries > (double-click) JRE System Libraries > Alternate Jre : jdk 1.8 >ok
    • Then from Installed JRES option in Libraries select jdk 1.8
    • Project > Clean
    • Maven > Update
    0 讨论(0)
  • 2020-12-10 12:35

    From the Maven Properties Guide:

    ${java.home} specifies the path to the current JRE_HOME environment use with relative paths to get for example: ${java.home}../bin/java.exe

    java.home property is not the same thing as JAVA_HOME environment setting. It is actually dynamic property showing you which JRE is running your code. 

    Try setting the java.home property correctly and see if it works.

    0 讨论(0)
  • 2020-12-10 12:36

    This error also occurs, if you have variable named as javapath. Try to delete it, if you've already specified e.g. like JAVA_HOME -> "C:\Program Files\Java\jdk1.8.0_171" and then in Path -> "%JAVA_HOME%\bin"

    0 讨论(0)
  • 2020-12-10 12:39

    Windows CMD don't refresh environment variables and you need run new instance for applying new environment setting and refresh new variable JAVA_HOME.

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