Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing jar file into IntelliJ Idea?

I want to use methods in Java Mail API, so I am trying to import its jar into my project on IntelliJ IDEA. How do I import or download this new jar? I am not new to IntelliJ IDEA, but haven't imported new jar in two months now.

Also, do I need other setup in order to use Java Mail API?

like image 365
user3014926 Avatar asked Jan 10 '14 18:01

user3014926


People also ask

How do I import files into IntelliJ?

Import a project from an external model Launch IntelliJ IDEA. If the Welcome screen opens, press Ctrl+Shift+A , type project from existing sources , and click the Import project from existing sources action in the popup. Otherwise, from the main menu, select File | New | Project from Existing Sources.


2 Answers

1) You need to create a Project in IntelliJ IDEA.

Now you have two options.

2.1.) Open the Project view in the IDE. Then right
click on your Project and do Open Module Settings (or press F4).

2.2.) From the File menu just choose Project structure.

3) Then go to Libraries on the left side. Then click the + sign (add new library).
Then locate your JAR and select it, this will import it as a library.

Note: The JAR you need to have downloaded first on your local machine.

Here is a screenshot, with added one JAR to a project I just created.

enter image description here

To make an example that works you'll need some mail servers.

See for example here.

http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/

like image 62
peter.petrov Avatar answered Oct 21 '22 15:10

peter.petrov


You can go to 'Project structure' with this short key 'Ctrl+Alt+Shift+s'

and in Library you can add your jar files

like image 37
Vahid Avatar answered Oct 21 '22 15:10

Vahid