Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class file not found in IntelliJ

Tags:

In IntelliJ I get this weird error when I try to compile.

Cannot find annotation method 'cascade()' in type 'javax.persistence.ManyToOne': class file for javax.persistence.ManyToOne not found 

I know, it seems pretty obvious what the problem is, but having spent too much time on this problem I now turn my trust to you!

I use ideaCommunity-9, where I have created a global library for JBoss, which contains all JBoss jars including ejb3-persistence.jar. My module includes this library, and I have moved it to the top of dependencies. No otherwhere in classpath I have a javax.persistence.ManyToOne class, and it also opens up in IntelliJ without problems.
If I open the file where I get the compile error, IntelliJ shows no problems and also navigates to the class file on pressing Ctrl+B.
The code is also build with ant and here it works fine.

Besides the above error I get six others along the same path (name in Table, etc.) - all related to JPA. I also get a message saying "Please file a bug to JDC yada yada yada."

like image 752
homaxto Avatar asked Feb 04 '10 12:02

homaxto


People also ask

Where can I find class file in IntelliJ?

class files by going to the out/production/main folders from the home directory of the project.

How do I add a class in IntelliJ?

In the Project tool window ( Alt+1 ), right-click the node in which you want to create a new class and select New | Java Class. Alternatively, select the node, press Alt+Insert , and select Java Class.

How do I find class files?

I simply open the java file location (in package explorer right click-->Show In -->System Explorer) go to top of the workspace and search for name of the file without extension. it gives me . class file as well.

Can not find or load main class IntelliJ?

2) "Run" menu -> " Edit configuration " -> delete the profile -> add back the profile ("Application" if it's a Java application), choose your main class from the "Main Class" dropdown menu. 3)"Build" menu -> " Rebuild Project ". Show activity on this post. Then open the project with IntelliJ.


1 Answers

Try to tick a checkbox "export" in your dependencies.

I mean: "File" menu -> Project Structure -> Modules -> Dependencies, and there you can see libs included to the module. You should also see a checkbox near each lib in column 'Export'.

like image 179
Roman Avatar answered Sep 30 '22 02:09

Roman