Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Within an IntelliJ project, I have set up a dependence on an external library (project structure -> Modules -> Dependencies -> Add -> Library). This library appears in the "External Libraries" tab on the left.

For classes which are placed directly in the src directory this works fine.

However, for packages I create within the project, IntelliJ doesn't recognize functions from the external library (I get a red line and a "cannot resolve symbol").

How should I set up the external library so that this issue is resolved?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
162 views
Welcome To Ask or Share your Answers For Others

1 Answer

  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).

  2. In the left-hand pane of the dialog, select Modules.

  3. In the pane to the right, select the module of interest.

  4. In the right-hand part of the dialog, on the Module page, select the Dependencies tab.

  5. On the Dependencies tab, click add and select Jars or directories.

  6. In the dialog that opens, select the necessary files and folders. These may be individual .class, .java, .jar and .zip files, and the directories containing such files. Click OK.

  7. If necessary, select the Export option and change the dependency scope.

8.Click OK in the Project Structure dialog.

Source


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...