Intellij 突然抛出 ClassNotFoundException [英] Intellij suddenly throwing ClassNotFoundException
问题描述
我在这里完全不知所措.我在外部硬盘驱动器上有一个名为 LenseProject 的项目.在 LenseProject 中,我有 .idea
、lib
、Natives
和 SRC
文件夹.我还有一些文本文件可供阅读.
I'm at a complete loss here. I have a project on an external hard drive called LenseProject. Inside LenseProject, I have .idea
, lib
, Natives
and SRC
folders. I also have a number of text files for reading.
当我昨晚下班时,一切正常.今天早上来,我遇到了:
When I left work last night, this all worked fine. Coming in this morning, I'm met with:
Exception in thread "main" java.lang.ClassNotFoundException: QuadTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
QuadTest 是主类.
QuadTest being the main class.
我认为可能有用的信息:
Information that I think might be helpful:
如果我注释掉导入,我会收到相应的错误消息.(找不到符号等).
If I comment out the imports, I get the appropriate error messages. (Cannot find symbol, etc).
我有 9 个依赖项,位于 liblwjgl-2.9.0jar 中,它们已设置在项目结构 -> 库中.
I have 9 dependencies, located in liblwjgl-2.9.0jar that are set up in Project Structure -> Libraries.
该模块以 LenseProject 作为内容根,SRC 作为源文件夹.
The module has LenseProject as the content root, and SRC as the source folder.
语言等级为7.0
我将依赖项设置为在项目结构 -> 模块中导出-> 依赖.
I have the dependencies set to export in Project Structure -> Modules -> Dependencies.
在编译器输出中,我将它设置为使用模块编译输出路径,因为继承项目编译输出路径给了我无法启动编译:未为模块指定输出路径镜头计划".在配置项目中指定输出路径.
In Compiler Output, I have it set to Use Module Compile Output Path, as Inherit Project Compile Output Path gave me "Cannot start compilation: The output path is not specified for module "LenseProject". Specify the output path in Configure Project.
我有虚拟机选项 -Djava.library.path=Natives
.
我可以通过命令提示符编译和运行程序,没问题.
I can compile and run the program through command prompt no problem.
我今天早上启动时缺少配置选项.我不得不再次设置 SDK 和库.
I was missing my configure options when I started it up this morning. I had to set the SDK again, and libraries.
推荐答案
Open your Idea File --> Project Structure --> Modules ,然后选择有问题的模块,在Paths"选项卡中选择Use module compile输出路径.
Open your Idea File --> Project Structure --> Modules ,and then choose problematic module,in the "Paths" tab change selected to "Use module compile output path ".
这篇关于Intellij 突然抛出 ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!