Fatal Error: Unable to find package java.lang in classpath or bootclasspath
生活随笔
收集整理的這篇文章主要介紹了
Fatal Error: Unable to find package java.lang in classpath or bootclasspath
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
前言
- centos 7.6
- jdk 1.8
- maven 3.6.3
報(bào)錯(cuò) Fatal Error: Unable to find package java.lang in classpath or bootclasspath
在本地使用打包命令(mvn clean package -Dmaven.test.skip=true)可以成功。
在centos 7.6中同樣的命令報(bào)錯(cuò)Fatal Error: Unable to find package java.lang in classpath or bootclasspath
網(wǎng)上查找該問題,發(fā)現(xiàn)修改bootclasspath導(dǎo)致。
因?yàn)樵趙indows和linux下,需要使用不同的分隔符。windows使用分號(hào)(;),linux使用冒號(hào)(:)。
修改
錯(cuò)誤的:
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target><compilerArguments><verbose/><bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath></compilerArguments></configuration></plugin></plugins> </build>正確的:
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target><compilerArguments><verbose/><bootclasspath>${java.home}/lib/rt.jar${path.separator}${java.home}/lib/jce.jar</bootclasspath></compilerArguments></configuration></plugin></plugins> </build>- 使用${path.separator}代替了分號(hào)
參考
https://blog.csdn.net/csdn565973850/article/details/101286678
https://blog.csdn.net/qq_30038111/article/details/106281811
總結(jié)
以上是生活随笔為你收集整理的Fatal Error: Unable to find package java.lang in classpath or bootclasspath的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 颌下淋巴结肿大最危险的症状是什么
- 下一篇: CentOS 7.6 安装 Maven