微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

centos下maven编译 mvn package 报错:No compiler is provided in this environment. Perhaps you are running

centos下maven编译 mvn package 报错:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project helloworld: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

答案:

32
down Vote
accepted
Apparently,it requires tools.jar file inside the lib folder of my $JAVA_HOME. I did not have the lib folder,so I reinstalled my jdk using command

apt-get install openjdk-7-jdk openjdk-7-doc openjdk-7-jre-lib
Also,this link may help some people.

shareimprove this answer

注意,假如你是jdk8的请将7替换成8。

centos 用这个
yum -y  install openjdk-8-jdk openjdk-8-doc openjdk-8-jre-lib

解决方

在centos7的terminal中输入java -verison是没问题的,但是javac的话就会提示没有此命令
百度了好久,说的很复杂,照着做了,最后也没有成功
后来在stackoverflow上看到了这个
84 down Vote accepted
You installed the Java Runtime Environment (JRE) only,which does not contain javac. For javac,you have to install the OpenJDK Development Environment. You can install java-devel or java-1.6.0-openjdk-devel,which both include javac.
By the way: you can find out which package provides javac with a yum search,e.g.
su -c ‘yum provides javac’
Another note: using yum and openjdk is only one possibility to install the JDK. Many people prefer Sun/Oracle’s “original” SDK. See How to install Java SDK on CentOS? and links for alternatives.

大意就是我们用yum来装原生的就行了 使用 yum install java-devel 就行了

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native
centos6.5下postgres-XC集群安装与配置
CentOS 6使用openssl搭建根CA
CentOS6.6中安装VNC server
CentOS下更新Python最新版本