gpt4 book ai didi

Visual Studio Code 中的 Java 编译错误 : Could not find or load main class

转载 作者:太空宇宙 更新时间:2023-11-04 09:21:59 25 4
gpt4 key购买 nike

我错误地在控制台上执行了这两行:

rm -rf ~/Library/Application\ Support/Code/Cache/*

rm -rf ~/Library/Application\ Support/Code/CachedData/*

我希望清除缓存以提高速度,但后来我发现它删除了一些关键文件,然后我每次都无法调试我的java文件,这说:

bash-3.2$ /Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home/bin/java --enable-preview -Dfile.encoding=UTF-8 -cp /private/var/folders/58/tqd41r6x5rlfzms1y1rx7s_m0000gn/T/vscodesws_cb741/jdt_ws/jdt.ls-java-project/bin Test Error: Could not find or load main class Test Caused by: java.lang.ClassNotFoundException: Test

无法找到或加载主类?但在文件中主类是正确声明的,并且在问题发生之前我成功运行了。

非常感谢!

最佳答案

我终于明白了。只需打开一个文件夹即可免费操作。另外,不要更改setting.json。重新安装 macOS 后...(是的,这里没有错误)我得到了正确的setting.json,这是它的代码:

{
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.errors.incompleteClasspath.severity": "ignore",
"files.autoSave": "afterDelay",
"java.configuration.checkProjectSettingsExclusions": false,
"git.confirmSync": false,
"git.enableSmartCommit": true,
"terminal.integrated.lineHeight": 0,
"python.jediEnabled": false
}

关于Visual Studio Code 中的 Java 编译错误 : Could not find or load main class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58211143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com