欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Error:java: System Java Compiler was not found in classpath:

程序员文章站 2022-04-05 10:29:06
...

今天把项目的jdk版本从1.8换成1.7,在build项目时出现一下错误:

Error:java: System Java Compiler was not found in classpath:
java.lang.ClassNotFoundException: com.sun.tools.javac.api.JavacTool
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at org.jetbrains.jps.builders.impl.java.JavacCompilerTool.createCompiler(JavacCompilerTool.java:74)
	at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:51)
	at org.jetbrains.jps.javac.ExternalJavacProcess.compile(ExternalJavacProcess.java:190)
	at org.jetbrains.jps.javac.ExternalJavacProcess.access$300(ExternalJavacProcess.java:32)
	at org.jetbrains.jps.javac.ExternalJavacProcess$CompilationRequestsHandler$1.run(ExternalJavacProcess.java:255)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

主要原因是在没有完全切换jdk版本:
Error:java: System Java Compiler was not found in classpath:
Error:java: System Java Compiler was not found in classpath:

相关标签: jdk