0

I try to add external library to my current project, but my project can't pick up the library.

I have MyLib.java file in other directory. /Users/cat/myfile/github/JavaLib/MyLib.java

I want to my current project (/home/project/HelloWorld/HellowWorld.java) to use my MyLib.java

I'm following the steps to add Library to Intellij(15CE)

Menu->Project Structure->Libraries click (+) symbol->select Java -> select my path(/home/lib/)

Here is the screenshot enter image description here

1234
  • 539
  • 3
  • 12

1 Answers1

0

Now that you have added your JavaLib directory to the project you should be able to use the code inside JavaLib in your code now. Intellij should offer auto-complete when you start to type the name of a JavaLib class and automatically include the import for you in your code.

The disabled Apply button you circled isn't an issue. I get that in my view too. It just means nothing has changed that needs to be applied currently.

rj905
  • 1
  • 1
  • 3
  • My Project can not pick up the library(MyLib.java) in my project. When I type my class e.g. MyLib c = new MyLib(), Intellij don't autocomplete my methods – 1234 May 07 '16 at 18:48
  • Do you have a class named MyLib.java in that JavaLib? Did you export the class(es) to a java jar file following something like: http://stackoverflow.com/questions/2025607/how-to-create-a-jar-file-or-export-jar-on-intellij-like-eclipse-java-archive-e – rj905 May 07 '16 at 20:41
  • Yep, I create jar file in the directory, and add to Intellij and I can see the jar file from the left bar – 1234 May 08 '16 at 01:59