How do I import a jar in Eclipse?
You can add a jar in Eclipse by right-clicking on the Project → Build Path → Configure Build Path. Under Libraries tab, click Add Jars or Add External JARs and give the Jar. A quick demo here.
The above solution is obviously a "Quick" one. However, if you are working on a project where you need to commit files to the source control repository, I would recommend adding Jar files to a dedicated library folder within your source control repository and referencing few or all of them as mentioned above.
Adding external Jar is not smart in case you want to change the project location in filesystem.
The best way is to add the jar to build path so your project will compile if exported:
Create a folder called lib in your project folder.
copy to this folder all the jar files you need.
Refresh your project in eclipse.
Select all the jar files, then right click on one of them and select Build Path -> Add to Build Path
Two choices:
1/ From the project:
2/ If you have already other jar imported, from the directory "References Libraries":
Both will lead you to this screen where you can mange your libraries:
Here are the steps:
click File > Import. The Import window opens.
Under Select an import source, click J2EE > App Client JAR file.
Click Next.
In the Application Client file field, enter the location and name of the application client JAR file that you want to import. You can click the Browse button to select the JAR file from the file system.
In the Application Client project field, type a new project name or select an application client project from the drop-down list. If you type a new name in this field, the application client project will be created based on the version of the application client JAR file, and it will use the default location.
In the Target runtime drop-down list, select the application server that you want to target for your development. This selection affects the run time settings by modifying the class path entries for the project.
If you want to add the new module to an enterprise application project, select the Add project to an EAR check box and then select an existing enterprise application project from the list or create a new one by clicking New.
Note: If you type a new enterprise application project name, the enterprise application project will be created in the default location with the lowest compatible J2EE version based on the version of the project being created. If you want to specify a different version or a different location for the enterprise application, you must use the New Enterprise Application Project wizard.
Click Finish to import the application client JAR file.
Just a comment on importing jars into Eclipse (plug-in development) projects:
In case you are developing Eclipse plug-ins, it makes sense to use Eclipse's native bundling mechanism instead of just importing the jar into a plug-in project. Eclipse (or better its underlying OSGi runtime, Equinox) uses so-called bundles which contain some more information than plain jars (e.g., version infos, dependencies to other bundles, exported packages; see the MANIFEST.MF file). Because of this information, OSGi bundles can be dynamically loaded/unloaded and there is automatic dependency resolution available in an OSGi/Eclipse runtime. Hence, using OSGi bundles instead of plain jars (contained inside another OSGi bundle) has some advantages.
(BTW: Eclipse plug-ins are the same thing as OSGi bundles.)
There is a good chance that somebody already bundled a certain (3rd party) library as an OSGi bundle. You might want to take a look at the following bundle repositories:
http://www.springsource.com/repository/app/
http://download.eclipse.org/tools/orbit/downloads/
http://www.osgi.org/Repository/HomePage
Eclipse -> Preferences -> Java -> Build Path -> User Libraries -> New(Name it) -> Add external Jars
(I recommend dragging your new libraries into the eclipse folder before any of these steps to keep everything together, that way if you reinstall Eclipse or your OS you won't have to rwlink anything except the JDK) Now select the jar files you want. Click OK.
Right click on your project and choose Build Path -> Add Library
FYI just code and then right click and Source->Organize Imports
Jar File in the system path is:
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar
ojdbc14.jar(it's jar file)
To import jar file in your Eclipse IDE, follow the steps given below.
Right-click on your project
Select Build Path
Click on Configure Build Path
Click on Libraries, select Modulepath and select Add External JARs
Select the jar file from the required folder
Click and Apply and Ok
first of all you will go to your project what you are created
and next right click in your mouse and select properties in the bottom
and select build in path in the left corner and add external jar file add click apply .that's it
In eclipse I included a compressed jar file i.e. zip file. Eclipse allowed me to add this zip file as an external jar but when I tried to access the classes in the jar they weren't showing up.
After a lot of trial and error I found that using a zip format doesn't work. When I added a jar file then it worked for me.
Right Click on the Project.
Click on Build Path.
Click On Configure Build Path.
Under Libraries, Click on Add Jar or Add External Jar.
If you are having a trouble on udemy course of chad on springboot for the importing the jar. Then follow these steps.
Right click on the project.
You will see a option of Build Path, click on it.
You will have a option of Configure Build path, click on it.
Go to libraries.
Then go to the place where you have a jar files make them into a new folder and upload on a new place.
Then click on Add External Jars, you will surely be able to upload it which will help on classpathxmlapplicationcontext as well.
Thank you.
I am new for Spring JDBC Template.
I am using Eclipse Kepler IDE and Mysql DB.
I trying to insert the data in DB using Spring JDBCTemplate, but its showing error as "Configure build path".(refer the screen shot)
I have added all the related JARS in my project build path.
Kindly advise me how to resolve this issue .
Click "Configure build path" (in your screenshot), a window will emerge.
OR
Right click on your project (in project explorer) ->Configure ->Build Path
In the emerging window, you will find four tabs, select "Libraries".There, under You can find "Web app libraries" OR "Maven Dependencies" (after expand it)
2.You will see the libraries added to the project's classpath. look out for JDBC jar and IMPORT it into your project.
Try to remove and add spring-jdbc jar as external jar as below.
Java Build Path -> Libraries -> Add External JARs
Same error I faced once and by changing or downgrading the version of spring framework helped me to resolve this error.
Old maven dependency ---
and changed to -----
hi guy iam facing a problem in my Liferay Eclipse project. I have included in it some required jar files using Right_click_on_project -> Properties -> Deployment Assembly.
when i try to remove them using the same procedure an clicking on Apply button they are removed. but when i come back again the deleted jar figure again. doing and doing again the result is always the same: the jar are not removed!
how to delete those jar as they are not needed anymore in my project? i tryed to manually delete them. but their entries always figure in the Deployment Assembly with yellow mark.
Ian using eclipse Luna with liferay plugin 6.1 and Ivy.
i figured how to get rid of those jar file.
i went to the directory liferay_sdk -> portlet -> eclipse_plugin_project_name -> .settings
and then i deleted entries relative to those included jar file in file org.eclipse.wst.common.component.
I have a Java project which I imported to Eclipse IDE 3.6. When I try to add this project to Tomcat 6.X it's throwing an error; "there are no such resources that can be added".
I searched over internet and find some solution that has given some steps to make a normal java project to Dynamic web project, but still it didn't work. I'm unable to add this project to tomcat. So I'm unable to debug the application, and its eating lot of my time for each small change.
Please guide me in this.
Thanks
Ok, this is a guide on how to convert your project to a Dynamic Web Project. You cannot add a project to the managed tomcat unless this has been done.
Open your .project file inside the Project folder (you have to switch to eclipse's "Navigator" view instead of the "Package Explorer" view in order to see this and other eclipse-specific files).
In the <natures> block, insert these lines if they are not already present:
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
Save the file, then right-click your project and click on Properties. There should be an entry labeled "Project Facets" on the left side. (The entry is not there unless you placed the nature entries in the .project file) Check "Dynamic Web Module" and "Java" on the right side (checking "Java" is required in order to check "Dynamic Web Module".
Click Apply and OK, after this your tomcat should let you add this project.
I have a dynamic-web project set up on Eclipse and I'm using Tomcat 7 as my web server. It doesn't seem to be automatically putting 3rd party JARs I add to my library on my build path into the WEB-INF/lib folder. Is there a way I can do this automatically? Every time I search for an answer to this, I find something like this.
So how do I do that automatically? Is there a way to configure my build path to do this?
Here are the instructions for Helios. For earlier releases, see SeanA's answer.
Project Properties -> Deployment Assembly
Add -> Java Build Path Entries
You should now see the list of libraries on your build path that you can specify for inclusion into your finished WAR.
Select the ones you want and hit Finish.
You can use "Ant" to copy files to WEB-INF/lib when you deploy files. Using Ant you will be able to copy only those files which have changed.
http://ant.apache.org/manual/Tasks/copy.html
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/gettingStarted/qs-81_basics.htm
I haven't tried this personally, but what I believe it does is what I think you are looking for:
Right-click project -> Properties
Go to Java EE Module Dependencies
Check the boxes for the JARs that you want to export with your Web Application
Let me know if this automatically puts them in your exported WAR. I always just add mine to WEB-INF/lib :)
Instructios for Eclipse Indigo (version 3.7.2)
Project Properties -> Deployment Assembly
Add -> Archives From File System -> Next -> Add
(The file dialog of your system opens up.)
Navigate to the archive you want to include in your WEB-INF/lib, select it and hit OK.
Hit Finish.
Hit OK.