在eclipse下用maven编译时,可能报以下提示 

Please ensure you are using JDK 1.4 or above and not a JRE (the com.sun.tools.javac.Main class is required). 

原因:eclipse默认是使用jre作为运行环境,而maven编译需要jdk作为运行环境

因此,我们只要设置为jdk即可。

具体步骤:

window -> preferences -> Java -> installed jres,点击add,新加一个环境,设为默认环境,注意location选择为你的jdk目录。

Maven报错Please ensure you are using JDK 1.4 or above and not a JRE解决方法

之后,在你的项目上右击,build path -> configure build path,编辑JRE System Library,选择刚才新建的默认环境

Maven报错Please ensure you are using JDK 1.4 or above and not a JRE解决方法

这样就解决问题了。

相关文章:

  • 2021-05-24
  • 2021-10-19
  • 2021-05-24
猜你喜欢
  • 2021-07-18
  • 2022-12-23
  • 2021-09-29
  • 2021-09-26
  • 2021-06-20
  • 2021-03-30
  • 2022-12-23
相关资源
相似解决方案