在类路径或引导类路径中找不到程序包 java.lang

转载 2017年02月21日 15:24:50

这是一篇以异常信息为标题的文章,因为解决的时间耗时很长所以需要纪录一下。

异常

这是在基于 maven 编写java项目的时候,使用 mvn install 时发生的异常,异常信息如下

[源文件的搜索路径: /Users/Frank/workspace-java/project/app-web/src/main/java,/Users/Frank/workspace-java/project/app-web/target/generated-sources/annotations]  
[类文件的搜索路径: /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/rt.jar;/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/jce.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/cldrdata.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/dnsns.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/jaccess.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/jfxrt.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/localedata.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/nashorn.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/sunec.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/zipfs.jar,/System/Library/Java/Extensions/MRJToolkit.jar,/Users/Frank/workspace-java/projects/app-web/target/classes,/Users/Frank/workspace-java/hnProjects/app-configs/target/app-configs-1.0-SNAPSHOT.jar,/Users/Frank/workspace-java/hnProjects/app-utils/target/app-utils-1.0-SNAPSHOT.jar,/Users/Frank/.m2/repository/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar,/Users/Frank/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar,/Users/Frank/.m2/repository/commons-codec/commons-codec/1.9/commons-codec-1.9.jar,/Users/Frank/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar,/Users/Frank/.m2/repository/org/apache/httpcomponents/httpclient/4.3.6/httpclient-4.3.6.jar,/Users/Frank/.m2/repository/org/apache/httpcomponents/httpcore/4.3.3/httpcore-4.3.3.jar,/Users/Frank/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar,/Users/Frank/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar,/Users/Frank/.m2/repository/org/apache/ant/ant/1.9.4/ant-1.9.4.jar,/Users/Frank/.m2/repository/org/apache/ant/ant-launcher/1.9.4/ant-launcher-1.9.4.jar,/Users/Frank/.m2/repository/net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar,/Users/Frank/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar,/Users/Frank/.m2/repository/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar,/Users/Frank/.m2/repository/com/github/junrar/junrar/0.7/junrar-0.7.jar,/Users/Frank/.m2/repository/com/github/junrar/junrar/0.7/commons-logging-api-1.1.jar,/Users/Frank/.m2/repository/com/github/junrar/junrar/0.7/commons-vfs2-2.0.jar,/Users/Frank/.m2/repository/com/github/junrar/junrar/0.7/commons-logging-1.1.1.jar,/Users/Frank/.m2/repository/com/github/junrar/junrar/0.7/maven-scm-api-1.4.jar,/Users/Frank/.m2/repository/com/github/junrar/junrar/0.7/plexus-utils-1.5.6.jar,/Users/Frank/.m2/repository/com/github/junrar/junrar/0.7/maven-scm-provider-svnexe-1.4.jar,/Users/Frank/.m2/repository/com/github/junrar/junrar/0.7/maven-scm-provider-svn-commons-1.4.jar,/Users/Frank/.m2/repository/com/github/junrar/junrar/0.7/regexp-1.3.jar,/Users/Frank/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar,/Users/Frank/.m2/repository/org/apache/commons/commons-vfs2/2.0/commons-vfs2-2.0.jar,/Users/Frank/.m2/repository/org/apache/maven/scm/maven-scm-api/1.4/maven-scm-api-1.4.jar,/Users/Frank/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar,/Users/Frank/.m2/repository/org/apache/maven/scm/maven-scm-provider-svnexe/1.4/maven-scm-provider-svnexe-1.4.jar,/Users/Frank/.m2/repository/org/apache/maven/scm/maven-scm-provider-svn-commons/1.4/maven-scm-provider-svn-commons-1.4.jar,/Users/Frank/.m2/repository/regexp/regexp/1.3/regexp-1.3.jar,/Users/Frank/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar,/Users/Frank/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar,/Users/Frank/.m2/repository/org/jsoup/jsoup/1.8.1/jsoup-1.8.1.jar,/Users/Frank/.m2/repository/commons-fileupload/commons-fileupload/1.3.1/commons-fileupload-1.3.1.jar,/Users/Frank/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar,/Users/Frank/.m2/repository/joda-time/joda-time/2.6/joda-time-2.6.jar,/Users/Frank/.m2/repository/com/google/code/gson/gson/2.3.1/gson-2.3.1.jar,/Users/Frank/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar,/Users/Frank/.m2/repository/com/googlecode/xmemcached/xmemcached/2.0.0/xmemcached-2.0.0.jar,/Users/Frank/.m2/repository/javax/mail/mail/1.4.1/mail-1.4.1.jar,/Users/Frank/.m2/repository/javax/mail/mail/1.4.1/activation.jar,/Users/Frank/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar,/Users/Frank/.m2/repository/com/belerweb/pinyin4j/2.5.0/pinyin4j-2.5.0.jar,/Users/Frank/.m2/repository/org/jdom/jdom/2.0.2/jdom-2.0.2.jar,/Users/Frank/.m2/repository/org/apache/poi/poi-scratchpad/3.10.1/poi-scratchpad-3.10.1.jar,/Users/Frank/.m2/repository/org/apache/poi/poi/3.11/poi-3.11.jar,/Users/Frank/.m2/repository/org/springframework/spring-core/4.1.4.RELEASE/spring-core-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/springframework/spring-context/4.1.4.RELEASE/spring-context-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/springframework/spring-aop/4.1.4.RELEASE/spring-aop-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar,/Users/Frank/.m2/repository/org/springframework/spring-beans/4.1.4.RELEASE/spring-beans-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/springframework/spring-expression/4.1.4.RELEASE/spring-expression-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/springframework/spring-context-support/4.1.4.RELEASE/spring-context-support-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/springframework/spring-webmvc/4.1.4.RELEASE/spring-webmvc-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/springframework/spring-web/4.1.4.RELEASE/spring-web-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/springframework/spring-jdbc/4.1.4.RELEASE/spring-jdbc-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/springframework/spring-tx/4.1.4.RELEASE/spring-tx-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/springframework/spring-orm/4.1.4.RELEASE/spring-orm-4.1.4.RELEASE.jar,/Users/Frank/.m2/repository/org/aspectj/aspectjweaver/1.8.4/aspectjweaver-1.8.4.jar,/Users/Frank/.m2/repository/org/hibernate/hibernate-core/4.3.7.Final/hibernate-core-4.3.7.Final.jar,/Users/Frank/.m2/repository/org/jboss/logging/jboss-logging/3.1.3.GA/jboss-logging-3.1.3.GA.jar,/Users/Frank/.m2/repository/org/jboss/logging/jboss-logging-annotations/1.2.0.Beta1/jboss-logging-annotations-1.2.0.Beta1.jar,/Users/Frank/.m2/repository/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.0.Final/jboss-transaction-api_1.2_spec-1.0.0.Final.jar,/Users/Frank/.m2/repository/org/hibernate/common/hibernate-commons-annotations/4.0.5.Final/hibernate-commons-annotations-4.0.5.Final.jar,/Users/Frank/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar,/Users/Frank/.m2/repository/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar,/Users/Frank/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar,/Users/Frank/.m2/repository/org/jboss/jandex/1.1.0.Final/jandex-1.1.0.Final.jar,/Users/Frank/.m2/repository/org/hibernate/hibernate-entitymanager/4.3.7.Final/hibernate-entitymanager-4.3.7.Final.jar,/Users/Frank/.m2/repository/org/hibernate/hibernate-ehcache/4.3.7.Final/hibernate-ehcache-4.3.7.Final.jar,/Users/Frank/.m2/repository/org/hibernate/hibernate-validator/5.1.3.Final/hibernate-validator-5.1.3.Final.jar,/Users/Frank/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar,/Users/Frank/.m2/repository/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar,/Users/Frank/.m2/repository/org/freemarker/freemarker/2.3.21/freemarker-2.3.21.jar,/Users/Frank/.m2/repository/net/sf/ehcache/ehcache-core/2.6.10/ehcache-core-2.6.10.jar,/Users/Frank/.m2/repository/com/alibaba/fastjson/1.2.4/fastjson-1.2.4.jar,/Users/Frank/.m2/repository/com/alibaba/druid/1.0.12/druid-1.0.12.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/../lib/jconsole.jar,/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/../lib/tools.jar,/Users/Frank/.m2/repository/mysql/mysql-connector-java/5.1.34/mysql-connector-java-5.1.34.jar,/Users/Frank/.m2/repository/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.jar,/Users/Frank/.m2/repository/org/slf4j/slf4j-api/1.7.9/slf4j-api-1.7.9.jar,/Users/Frank/workspace-java/hnProjects/app-dao/target/app-dao-1.0-SNAPSHOT.jar,/Users/Frank/workspace-java/hnProjects/app-service/target/app-service-1.0-SNAPSHOT.jar,/Users/Frank/.m2/repository/javax/servlet/jsp/jstl/javax.servlet.jsp.jstl-api/1.2.1/javax.servlet.jsp.jstl-api-1.2.1.jar,/Users/Frank/.m2/repository/javax/el/javax.el-api/2.2.4/javax.el-api-2.2.4.jar,/Users/Frank/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar,/Users/Frank/.m2/repository/javax/servlet/jsp/javax.servlet.jsp-api/2.3.1/javax.servlet.jsp-api-2.3.1.jar,.]  
致命错误: 在类路径或引导类路径中找不到程序包 java.lang  
[INFO] -------------------------------------------------------------  
[ERROR] COMPILATION ERROR :   
[INFO] -------------------------------------------------------------  
[ERROR] An unknown compilation problem occurred  
[INFO] 1 error  
[INFO] -------------------------------------------------------------  
[INFO] ------------------------------------------------------------------------  
[INFO] Reactor Summary:  
[INFO]   
[INFO] Projects :: APP :: Parent ........................... SUCCESS [  0.357 s]  
[INFO] Projects :: APP :: Utils ............................ SUCCESS [  1.257 s]  
[INFO] Projects :: APP :: Configs .......................... SUCCESS [  0.374 s]  
[INFO] Projects :: APP :: Dao .............................. SUCCESS [  0.172 s]  
[INFO] Projects :: APP :: Service .......................... SUCCESS [  0.152 s]  
[INFO] Projects :: APP :: Admin ............................ SUCCESS [  1.273 s]  
[INFO] Projects :: APP :: Web .............................. FAILURE [  0.081 s]  
[INFO] xxx ................................................. SKIPPED  
[INFO] ------------------------------------------------------------------------  
[INFO] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------  
[INFO] Total time: 5.426 s  
[INFO] Finished at: 2016-07-22T21:26:15+08:00  
[INFO] Final Memory: 39M/310M  
[INFO] ------------------------------------------------------------------------  
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project app-web: Compilation failure  
[ERROR] An unknown compilation problem occurred  
[ERROR] -> [Help 1]  
[ERROR]   
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.  
[ERROR] Re-run Maven using the -X switch to enable full debug logging.  
[ERROR]   
[ERROR] For more information about the errors and possible solutions, please read the following articles:  
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException  
[ERROR]   
[ERROR] After correcting the problems, you can resume the build with the command  
[ERROR]   mvn  -rf :app-web  

原因

原因在于 compiler 插件的配置。

<!-- ... -->  
<plugin>  
 <groupId>org.apache.maven.plugins</groupId>  
 <artifactId>maven-compiler-plugin</artifactId>  
 <version>${maven.compiler.version}</version>  
 <configuration>  
   <source>${java.version}</source>  
   <target>${java.version}</target>  
   <encoding>${project.build.sourceEncoding}</encoding>  
   <showWarnings>true</showWarnings>  
   <compilerArguments>  
     <verbose />  
     <!-- 这个配置很特殊:windows下使用分号(;)分隔,linux/mac下使用冒号(:)分隔 -->  
     <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>  
   </compilerArguments>  
 </configuration>  
</plugin>  
<!-- ... -->  
配置中14行的分隔符问题,在windows下使

配置中14行的分隔符问题,在windows下使用maven 应该使用分号(;)分隔,linux/mac 下使用(:)分隔。

相关文章推荐

marven编译致命错误:在类路径或引导类路径中找不到软件包 java.lang的一种解决方法

由于换了linux系统,发现原来在Windows中可以正常编译执行的marven项目在linux下却不能使用。 ${java.home}/lib/rt.jar,${java.home}/lib/jc...

maven编译时报错:致命错误: 在类路径或引导类路径中找不到程序包 java.lang

maven编译时报错:致命错误: 在类路径或引导类路径中找不到程序包 java.lang: [INFO] Scanning for projects... [INFO]                ...

致命错误: 在类路径或引导类路径中找不到程序包 java.lang

[ERROR] [类文件的搜索路径: D:\Java\jdk1.7.0_15\jre\lib\rt.jar,D:\Java\jdk1.7.0_15\jre\lib\jce.jar,F:\Program...

maven 打包 致命错误:在类路径或引导类路径中找不到软件包 java.lang

致命错误:在类路径或引导类路径中找不到软件包 java.lang 改下 Windows(分隔符英文分号); bootclasspath>${java.home}/lib/rt.jar;${j...
  • skate6
  • skate6
  • 2017年04月24日 14:06
  • 1450

深入理解Java类加载器(1):Java类加载原理解析

1       基本信息 每个java开发人员对java.lang.ClassNotFoundExcetpion这个异常肯定都不陌生,这背后就涉及到了java技术体系中的类加载。Java的类加载...

类找不到总结java.lang.ClassNotFoundException

(1)org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class ‘com.microsoft.sql...
  • acm_lkl
  • acm_lkl
  • 2016年08月18日 18:43
  • 1138

IntelliJ编译时,致命错误:在路径和启动路径中找不到包java.lang

基础知识主要是发现自己的Java没有安装成功:……\Java\jdk1.8.0_121\lib里面没有tools.jar,dt.jar而假如正确安装的话,dt.jar和tools.jar位于:{Jav...

javassist使用中遇到的问题记录

Javassit提供了运行时操作Java字节码的方法,其效率低于asm。javassist主要是提供了代码级别的修改(也有bytecode级别),相比与asm的字节码级别的修改,学习成本低,开发效率高...

给定A, B两个整数,不使用除法和取模运算,求A/B的商和余数

给定A, B两个整数,不使用除法和取模运算,求A/B的商和余数。 1.   最基本的算法是,从小到大遍历: for (i = 2 to A -1)          if (i * B > A)...

利用K-means聚类算法根据经纬度坐标对中国省市进行聚类

K-means聚类算法是一种非层次聚类算法,在最小误差的基础上将数据划分了特定的类,类间利用距离作为相似度指标,两个向量之间的距离越小,其相似度就越高。程序读取全国省市经纬度坐标,然后根据经纬度坐标进...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:在类路径或引导类路径中找不到程序包 java.lang
举报原因:
原因补充:

(最多只允许输入30个字)