views:

3429

answers:

2

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

./projectname.iml
./projectname.ipr
./projectname.iws
./src/

I want to configure IntellJ to include my dependency JARs in ./lib/*.jar to the project. What is the correct way to achieve this in IntelliJ IDEA?

Yes - I'm an IntelliJ IDEA beginner :-)

A: 

Congratulations - you're using the best IDE on the market, in my opinion. Which version? 8.1?

You add them as libraries to your module.

I usually don't have a /lib in my source. I just cherry pick the JARs that I need from my disk and let IntelliJ just bring them into the /out directory as needed.

duffymo
I'm using 8.1. How to I add them as libraries to my module? I'm totally new to IntelliJ :-)
knorv
+11  A: 

File -> Project Structure (ctrl + shift + alt + s ) -> Module -> Dependencies -> add... -> Project Library -> Attach Jar

Cambium
+1 - This is the better answer. Knowing the shortcuts is invaluable, especially when you want to demonstrate where to go without the benefit of images from screen shots. 8)
duffymo
Also, consider adding a lib folder, and use "Attach Jar Directories", which will add all jars in the lib folder. For a largish project, this keeps you from having to choose each jar individually.
joeslice