How to import a jar file?

I use IntelliJ Idea to write an application, but I don't know how to import a jar file I need, and I compile and run it from console with javac/java using the -classpath option. Is there any way to use the IDE to compile and run my application? Thank you.

3 comments
Comment actions Permalink

Sure, just add the .jar file in Settings | Project Structure, Modules, module name, Dependencies tab using the Add button. You will probably need a Module Library (choose from the drop-down).

0
Comment actions Permalink

I imported that jar but I still get an exception when I try to run it from the IDE, though it works fine if I run it with "java" from the console. Any ideas? Thank you.

0
Comment actions Permalink

Please send your sample project illustrating the issue to support@jetbrains.com.

0

Please sign in to leave a comment.