Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project

后端 未结 9 1490
时光取名叫无心
时光取名叫无心 2020-11-21 10:20

When creating a new Java project in IntelliJ IDEA, the following directories and files are created:

./projectname.iml
./projectname.ipr
./projectname.iws
./s         


        
9条回答
  •  我在风中等你
    2020-11-21 10:52

    Libraries cannot be directly used in any program if not properly added to the project gradle files.

    This can easily be done in smart IDEs like inteli J.

    1) First as a convention add a folder names 'libs' under your project src file. (this can easily be done using the IDE itself)

    2) then copy or add your library file (eg: .jar file) to the folder named 'libs'

    3) now you can see the library file inside the libs folder. Now right click on the file and select 'add as library'. And this will fix all the relevant files in your program and library will be directly available for your use.

    Please note:

    Whenever you are adding libraries to a project, make sure that the project supports the library

提交回复
热议问题