Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ: Classes from imported jar not visible inside packages

I added external jar file(stdlib.jar on picture) to my project in IntelliJ(12.1.4), but when I want to use some static methods from it in created package(ChapterOne) it can't resolve it. However it finds classes in default package without problem. How I can make it work ?

It seems that dependencies are ok.

like image 219
ashur Avatar asked Aug 07 '13 18:08

ashur


People also ask

How do I see all classes in IntelliJ?

By default, IntelliJ IDEA shows all classes, methods, and other elements of the current file. To toggle the elements you want to show, click the corresponding buttons on the Structure tool window toolbar. to show class fields. to have protected class members shown in the tree.

How do I import a class from another package in IntelliJ?

IntelliJ IDEA suggests to import single classes by default. You can change the settings to import entire packages instead. In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Editor | Code Style | Java | Imports. Clear the Use single class import checkbox, and apply the changes.


1 Answers

The libraries were configured correctly in IDEA, but the jars actually contained sources, not classes. So the solution is to unpack these sources from the jar files into the module src directory.

like image 134
CrazyCoder Avatar answered Oct 17 '22 23:10

CrazyCoder