ToB企服应用市场:ToB评测及商务社交产业平台

标题: Maven打包遇到No compiler is provided in this environment. Perhaps you [打印本页]

作者: 杀鸡焉用牛刀    时间: 2022-8-13 03:19
标题: Maven打包遇到No compiler is provided in this environment. Perhaps you
问题:

maven打包时出现:No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?的报错

解决方案:卸载centos自带的java,安装jdk1.8

具体步骤:
1)查看系统是否已安装的java:rpm -qa|grep java

2)卸载已安装的jdk,注意一定要有java-XXX-jdk-XXX才能下载,输入指令如下
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.332.b09-1.el7_9.x86_64
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64

3)卸载后查看jdk输入指令:java -version

4)重新安装JDK,将对应的压缩包解压:tar -xzvf jdk-8u141-linux-x64.tar.gz

5)配置环境变量,在~/.bash_profile文件中添加如下两行
export JAVA_HOME=/usr/java/jdk1.8.0_141
export PATH=$PATH:$JAVA_HOME/bin

6)输入指令:source ~/.bash_profile使环境变量生效
7)再次使用Maven打包,可看到打包成功


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4