6

I am trying to follow the description here Correct way to add lib/*.jar to an IntelliJ IDEA project? in order to make some static utilities from a jar available, but keep getting "Cannot resolve symbol" errors.

I do the following: Go to project structure with Ctrl+Shift+Alt+S -> select module -> Dependencies ->

add -> Library -> find the jar -> accept the class and source destinations.

In the linked description "Project Libraries" is chosen instead of "Library", but I don't see that option running version 12.1.4.

In the project view, I do have a library under "External Libraries" containing the jar afterwards, but I keep getting "Cannot resolve Symbol" when I use a static method from the jar. When I expand the jar from the project view under its library under External Libraries, the needed class is present.I have tried different things from the Project Settings eg. adding the jar as "Jars or directories" but with the same result. The code I am referencing the class in the jar from, has an explicit package statement.

Community
  • 1
  • 1
  • A bit offtopic - but I suggest you use Gradle with the Gradle-idea plugin. Gradle will generate the corrects paths to the jars for you, fetches dependencies and you can build the project without IDEA, if you need to. [http://www.gradle.org, https://gist.github.com/weitzj/1580234, http://www.gradle.org/docs/current/userguide/idea_plugin.html] – Jan Weitz Sep 01 '13 at 09:25
  • Have you tried the dependency? – Marshal Chen Sep 01 '13 at 09:27
  • @Marshal Chen The library does appear under the dependencies tagif that is what you mean ? –  Sep 01 '13 at 09:30
  • @JanWeitz I would like to figure out how to this without Gradle :) –  Sep 01 '13 at 09:32
  • Yeah.Then what else would appear if you write the package name like "com.xxx.xxx" – Marshal Chen Sep 02 '13 at 00:33
  • Post sample project reproducing this problem. I will import it to see it on my own. – Leos Literak Apr 22 '14 at 17:46

1 Answers1

0

After adding the jar,Clear the Cache first and then run the sbt Clean,Reload and Update commands respectively from the command prompt or sbt console,which will helps the ide to adopt the code from the jar.

Jet
  • 3,018
  • 4
  • 33
  • 48