java: 程序包com.sun.tools.javac.comp不存在

这篇博客主要介绍了在Java项目中遇到找不到tools工具包的问题,该工具包通常包含在Java JDK中。解决方案是检查JDK安装路径是否正确,并将tools.jar添加到项目的类路径中,重新编译运行即可恢复正常。

报错信息

在这里插入图片描述
报错原因
项目找不到tools工具包,这个工具包,存放在JavaJDK中,
在这里插入图片描述
下面给项目添加这个工具包
在这里插入图片描述
在这里插入图片描述
然后重新编译运行就可以了

构建进程终止异常: E:\java1.8\bin\java.exe -Xmx700m -Djava.awt.headless=true "-Djna.boot.library.path=E:\java\IntelliJ IDEA 2023.3.5/lib/jna/amd64" -Djna.nosys=true -Djna.noclasspath=true --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -Dexternal.project.config=C:\Users\Lenovo\AppData\Local\JetBrains\IntelliJIdea2023.3\projects\idea.ab213168\external_build_system -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Didea.IntToIntBtree.page.size=32768 -Djdt.compiler.useSingleThread=true -Daether.connector.resumeDownloads=false -Dio.netty.initialSeedUniquifier=7747785284316372920 -Dfile.encoding=GBK -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IntelliJIdea2023.3 -Djps.language.bundle=C:/Users/Lenovo/AppData/Roaming/JetBrains/IntelliJIdea2023.3/plugins/zh.233.407/lib/zh.233.407.jar "-Didea.home.path=E:/java/IntelliJ IDEA 2023.3.5" -Didea.config.path=C:/Users/Lenovo/AppData/Roaming/JetBrains/IntelliJIdea2023.3 -Didea.plugins.path=C:/Users/Lenovo/AppData/Roaming/JetBrains/IntelliJIdea2023.3/plugins -Djps.log.dir=C:/Users/Lenovo/AppData/Local/JetBrains/IntelliJIdea2023.3/log/build-log "-Djps.fallback.jdk.home=E:/java/IntelliJ IDEA 2023.3.5/jbr" -Djps.fallback.jdk.version=17.0.12 -Dio.netty.noUnsafe=true -Djava.io.tmpdir=C:/Users/Lenovo/AppData/Local/JetBrains/IntelliJIdea2023.3/compile-server/idea_2f20a311/_temp_ -Djps.backward.
06-21
构建进程终止异常: "C:\Program Files\Java\jdk1.8.0_202\bin\java.exe" -Xmx700m -Djava.awt.headless=true "-Djna.boot.library.path=D:\IntelliJ IDEA 2024.1.4/lib/jna/amd64" -Djna.nosys=true -Djna.noclasspath=true --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -Dexternal.project.config=C:\Users\hj\AppData\Local\JetBrains\IntelliJIdea2024.1\projects\back.aed0241d\external_build_system -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Didea.IntToIntBtree.page.size=32768 -Djdt.compiler.useSingleThread=true -Daether.connector.resumeDownloads=false -Dio.netty.initialSeedUniquifier=-8101436330916038603 -Dfile.encoding=GBK -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IntelliJIdea2024.1 -Djps.language.bundle=C:/Users/hj/AppData/Roaming/JetBrains/IntelliJIdea2024.1/plugins/zh.241.271/lib/zh.241.271.jar "-Didea.home.path=D:/IntelliJ IDEA 2024.1.4" -Didea.config.path=C:/Users/hj/AppData/Roaming/JetBrains/IntelliJIdea2024.1 -Didea.plugins.path=C:/Users/hj/AppData/Roaming/JetBrains/IntelliJIdea2024.1/plugins -Djps.log.dir=C:/Users/hj/AppData/Local/JetBrains/IntelliJIdea2024.1/log/build-log "-Djps.fallback.jdk.home=D:/IntelliJ IDEA 2024.1.4/jbr" -Djps.fallback.jdk.version=17.0.11 -Dio.netty.noUnsafe=true -Djava.io.tmpdir=C:/Users/hj/AppData/Local/JetBrains/IntelliJIdea2024.1/compile-server/back_48b64500/_temp_ -Djps.backward.ref.index.builder=true -Djps.backward.ref.index.builder.fs.
06-18
构建进程终止异常: C:\Users\cheny.DESKTOP-IJUBGMA\.jdks\corretto-17.0.13\bin\java.exe -Xmx700m -Djava.awt.headless=true "-Djna.boot.library.path=C:\Program Files\JetBrains\IntelliJ IDEA 2024.3/lib/jna/amd64" -Djna.nosys=true -Djna.noclasspath=true --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -Dexternal.project.config=C:\Users\cheny.DESKTOP-IJUBGMA\AppData\Local\JetBrains\IntelliJIdea2024.3\projects\xzqlyxxt.b26de08b\external_build_system -Dcompile.parallel=true -Drebuild.on.dependency.change=true -Didea.IntToIntBtree.page.size=32768 -Djdt.compiler.useSingleThread=true -Daether.connector.resumeDownloads=false -Dio.netty.initialSeedUniquifier=8299567134934984099 -Djps.use.dependency.graph=true -Dfile.encoding=UTF-8 -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IntelliJIdea2024.3 "-Djps.language.bundle=C:/Program Files/JetBrains/IntelliJ IDEA 2024.3/plugins/localization-zh/lib/localization-zh.jar" "-Didea.home.path=C:/Program Files/JetBrains/IntelliJ IDEA 2024.3" -Didea.config.path=C:/Users/cheny.DESKTOP-IJUBGMA/AppData/Roaming/JetBrains/IntelliJIdea2024.3 -Didea.plugins.path=C:/Users/cheny.DESKTOP-IJUBGMA/AppData/Roaming/JetBrains/IntelliJIdea2024.3/plugins -Djps.log.dir=C:/Users/cheny.DESKTOP-IJUBGMA/AppData/Local/JetBrains/IntelliJIdea2024.3/log/build-log "-Djps.fallback.jdk.home=C:/Program Files/JetBrains/IntelliJ IDEA 2024.3/jb
06-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值