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 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).
I have 9 dependencies, located in lib\lwjgl-2.9.0\jar that are set up
in Project Structure -> Libraries.
The module has LenseProject as the content root, and SRC as the
source folder.
The language level is 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.
I have VM option -Djava.library.path=Natives
.
I can compile and run the program through command prompt no problem.
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 ,and then choose problematic module,in the "Paths" tab change selected to "Use module compile output path ".
I ran into a similar issue while writing unit tests. Everything would work at the command line but failed in IntelliJ. IntelliJ would successfully compile but not run the test.
Then I ran across a post on IntelliJ's blog: http://blog.jetbrains.com/idea/2014/03/intellij-idea-13-1-released/
anet says:
March 21, 2014 at 12:20 pm
You may remove the existing junit dependency and allow IDEA to add JUnit library for your from scratch.
New junit doesn’t bundle hamcrest anymore but still depends on it on runtime.
Thanks,
Anna
- See more at: http://blog.jetbrains.com/idea/2014/03/intellij-idea-13-1-released/#sthash.2KNQuwZ5.dpuf
I removed JUnit from my project settings and let IntelliJ add it back. Then things worked fine.
In my case, the problem was I reused the "out" directory for program output.
I solved it by redirect the output to another folder.
I had similar issue. A new dependency was not being found when running tomcat. The problem was it wasn't being deployed to /WEB-INF/lib
. After half a day banging my head on the desk I found this YouTube video that fixed it.
Essentially I needed to add the dependencies from module settings-> artifact->MyWar->Output Layout tab. Under available elements open your projects folder. If there are maven dependencies listed there, select them. Then right click->Put into /WEB-INF/lib
I suggest confirming your Run Configuration
as follows:
Toolbar: Run
->Edit Configurations...
, confirm your Configuration is correct.
Hope it helps.
I know its a bit old post but for me helped by going to Run-->Edit Configurations--> In Application Selected your main code file --> Configuration on the right panel. Checked "Use alternative JRE:" and selecting JDK folder called jre(.../Java/jdk.x.x.x_xx/jre). Apply and OK. I am really new with intelliJ but that solved my problem hope it helps someone.
My problem was, that all this renaming the project-structure, my Maven dependencies didn't mach.
After changing the maven dependencies in the pom file, it worked.
File -> Project Structrure -> Project.
Change the Project Language level from "SDK default" to Actual version that you are using.
This is weird, but solves the problem.
Try going to Preferences -> Compiler
and select Eclipse, rather than using javac.