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

钦高峯
2023-12-01

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

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building weixin_project Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ weixin_project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ weixin_project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to E:\Spring-tool-suit\weixin_project\target\classes
[语法分析开始时间 RegularFileObject[E:\Spring-tool-suit\weixin_project\src\main\java\org\seele\weixin\servlet\CoreServlet.java]]
[语法分析已完成, 用时 12 毫秒]
[语法分析开始时间 RegularFileObject[E:\Spring-tool-suit\weixin_project\src\main\java\org\seele\weixin\servlet\SignUtil.java]]
[语法分析已完成, 用时 3 毫秒]
[源文件的搜索路径: E:\Spring-tool-suit\weixin_project\src\main\java]
[类文件的搜索路径: C:\Program Files\Java\jdk1.7.0_17\jre\rt.jar,C:\Program Files\Java\jdk1.7.0_17\jre\jce.jar,C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\access-bridge-64.jar,C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\dnsns.jar,C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\jaccess.jar,C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\localedata.jar,C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\sunec.jar,C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\sunjce_provider.jar,C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\sunmscapi.jar,C:\Program Files\Java\jdk1.7.0_17\jre\lib\ext\zipfs.jar,E:\Spring-tool-suit\weixin_project\target\classes,E:\apache-maven-3.3.9\repository\jaxen\jaxen\1.1.4\jaxen-1.1.4.jar,E:\apache-maven-3.3.9\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar,E:\apache-maven-3.3.9\repository\org\wicketstuff\jsr303\1.5-RC5.1\jsr303-1.5-RC5.1.jar,E:\apache-maven-3.3.9\repository\javax\validation\validation-api\1.0.0.GA\validation-api-1.0.0.GA.jar,E:\apache-maven-3.3.9\repository\org\apache\wicket\wicket-core\1.5-RC5.1\wicket-core-1.5-RC5.1.jar,E:\apache-maven-3.3.9\repository\org\apache\wicket\wicket-util\1.5-RC5.1\wicket-util-1.5-RC5.1.jar,E:\apache-maven-3.3.9\repository\org\apache\wicket\wicket-request\1.5-RC5.1\wicket-request-1.5-RC5.1.jar,E:\apache-maven-3.3.9\repository\org\hibernate\hibernate-validator\4.3.1.Final\hibernate-validator-4.3.1.Final.jar,E:\apache-maven-3.3.9\repository\org\jboss\logging\jboss-logging\3.1.0.CR2\jboss-logging-3.1.0.CR2.jar,E:\apache-maven-3.3.9\repository\org\hibernate\hibernate-core\4.2.0.Final\hibernate-core-4.2.0.Final.jar,E:\apache-maven-3.3.9\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar,E:\apache-maven-3.3.9\repository\org\jboss\spec\javax\transaction\jboss-transaction-api_1.1_spec\1.0.0.Final\jboss-transaction-api_1.1_spec-1.0.0.Final.jar,E:\apache-maven-3.3.9\repository\org\hibernate\javax\persistence\hibernate-jpa-2.0-api\1.0.1.Final\hibernate-jpa-2.0-api-1.0.1.Final.jar,E:\apache-maven-3.3.9\repository\org\javassist\javassist\3.15.0-GA\javassist-3.15.0-GA.jar,E:\apache-maven-3.3.9\repository\org\hibernate\common\hibernate-commons-annotations\4.0.1.Final\hibernate-commons-annotations-4.0.1.Final.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-context\3.2.2.RELEASE\spring-context-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-expression\3.2.2.RELEASE\spring-expression-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-core\3.2.2.RELEASE\spring-core-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-beans\3.2.2.RELEASE\spring-beans-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-aop\3.2.2.RELEASE\spring-aop-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-orm\3.2.2.RELEASE\spring-orm-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-jdbc\3.2.2.RELEASE\spring-jdbc-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\mysql\mysql-connector-java\5.1.24\mysql-connector-java-5.1.24.jar,E:\apache-maven-3.3.9\repository\com\kenai\nbpwr\javax-inject\1.0-201002241208\javax-inject-1.0-201002241208.jar,E:\apache-maven-3.3.9\repository\com\kenai\nbpwr\javax-inject\1.0-201002241208\ext\javax.inject-1.jar,E:\apache-maven-3.3.9\repository\javax\inject\javax.inject\1\javax.inject-1.jar,E:\apache-maven-3.3.9\repository\commons-dbcp\commons-dbcp\1.4\commons-dbcp-1.4.jar,E:\apache-maven-3.3.9\repository\commons-pool\commons-pool\1.5.4\commons-pool-1.5.4.jar,E:\apache-maven-3.3.9\repository\org\slf4j\slf4j-api\1.7.5\slf4j-api-1.7.5.jar,E:\apache-maven-3.3.9\repository\org\aspectj\aspectjweaver\1.7.2\aspectjweaver-1.7.2.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-webmvc\3.2.2.RELEASE\spring-webmvc-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-web\3.2.2.RELEASE\spring-web-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar,E:\apache-maven-3.3.9\repository\jstl\jstl\1.2\jstl-1.2.jar,E:\apache-maven-3.3.9\repository\javax\servlet\jsp\jsp-api\2.2\jsp-api-2.2.jar,E:\apache-maven-3.3.9\repository\jsptags\pager-taglib\2.0\pager-taglib-2.0.jar,E:\apache-maven-3.3.9\repository\commons-fileupload\commons-fileupload\1.3\commons-fileupload-1.3.jar,E:\apache-maven-3.3.9\repository\commons-io\commons-io\2.4\commons-io-2.4.jar,E:\apache-maven-3.3.9\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar,E:\apache-maven-3.3.9\repository\org\apache\httpcomponents\httpclient\4.5\httpclient-4.5.jar,E:\apache-maven-3.3.9\repository\org\apache\httpcomponents\httpcore\4.4.1\httpcore-4.4.1.jar,E:\apache-maven-3.3.9\repository\org\apache\httpcomponents\httpmime\4.5\httpmime-4.5.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-tx\3.2.2.RELEASE\spring-tx-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\org\springframework\spring-context-support\3.2.2.RELEASE\spring-context-support-3.2.2.RELEASE.jar,E:\apache-maven-3.3.9\repository\org\quartz-scheduler\quartz\1.8.6\quartz-1.8.6.jar,E:\apache-maven-3.3.9\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar,E:\apache-maven-3.3.9\repository\xml-apis\xml-apis\1.0.b2\xml-apis-1.0.b2.jar,.]


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


[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] An unknown compilation problem occurred
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.078 s
[INFO] Finished at: 2016-08-02T23:43:33+08:00
[INFO] Final Memory: 16M/217M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project weixin_project: 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在


解决方法:
在maven的配置文件pom.xml中,把 <bootclasspath>${java.home}/rt.jar;${java.home}/jce.jar</bootclasspath> 
注释即可

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<verbose />
<!-- <bootclasspath>${java.home}/rt.jar;${java.home}/jce.jar</bootclasspath> -->
</compilerArguments>
</configuration>
</plugin>
<plugin>







 类似资料: