在类路径或引导类路径中找不到程序包 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 下使用(:)分隔。

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

报错信息: [INFO] Changes detected - recompiling the module! [INFO] Compiling 470 source files to /Users/...
  • bao19901210
  • bao19901210
  • 2017-12-21 16:26:12
  • 319

Maven install 异常,致命错误: 在类路径或引导类路径中找不到程序包 java.lang。

Maven install 异常,致命错误: 在类路径或引导类路径中找不到程序包 java.lang。...
  • en_joker
  • en_joker
  • 2017-12-20 11:13:02
  • 369

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

这是一篇以异常信息为标题的文章,因为解决的时间耗时很长所以需要纪录一下。 异常 这是在基于 maven 编写java项目的时候,使用 mvn install 时发生的异常,异常信息如下 ...
  • cleargreen
  • cleargreen
  • 2017-02-21 15:24:50
  • 2554

Maven编译:[ERROR] 致命错误: 在类路径或引导类路径中找不到程序包 java.lang

Maven编译:[ERROR] 致命错误: 在类路径或引导类路径中找不到程序包 java.lang在Windows中可以正常编译执行的maven工程,在linux用jenkins打包编译时出错[ERR...
  • u013944791
  • u013944791
  • 2017-04-05 14:37:41
  • 1769

致命错误: 在类路径或引导类路径中找不到程序包 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...
  • qq496013218
  • qq496013218
  • 2017-03-16 15:00:32
  • 3739

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

maven编译时报错:致命错误: 在类路径或引导类路径中找不到程序包 java.lang: [INFO] Scanning for projects... [INFO]                ...
  • u012759397
  • u012759397
  • 2016-08-03 00:01:28
  • 12373

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

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

JAVA错误: 找不到或无法加载主类

检查环境变量配置: JAVA_HOME:D:\Java\jdk1.8.0_91 CLASSPATH:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.j...
  • u013142248
  • u013142248
  • 2016-11-05 22:44:35
  • 21348

运行java类 找不到主类的错误

发信人:   SuperMMX   (笑天子),   信区:   Java 标     题:   [整理]   Java   的   Class   Path   和   Package 发信...
  • gongweijiao
  • gongweijiao
  • 2011-11-13 13:24:39
  • 16860

java 错误: 找不到符号遇到的几种情况

今天在学习java面向对象的时候写了两个类,在运行时出现了以下错误: 然后下面是我的两个java类 public class ArrayTool { ArrayTool(){ ...
  • qq_35091305
  • qq_35091305
  • 2017-07-19 19:56:59
  • 12864
收藏助手
不良信息举报
您举报文章:在类路径或引导类路径中找不到程序包 java.lang
举报原因:
原因补充:

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