how to add. JAR in my project? [duplicate] - java

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Adding a library/JAR to an Eclipse Android project
I found an interesting project to me, Wanted to use his library but I can not add to my library, as in the example
I do it in eclipse
I can not add. Jar in my library

Right click your project, select Build Path -> Configure Build Path.... On the Libraries tab you can add the library.
If the JAR is contained in a project folder select Add JARs.... If you want to add it from the file system select Add External JARs.

Right click on project Build path is displayed, take mouse over build path other option is displayed then click on configure build path
A new windows open check libraries is displayed at top navigation
Click on the libraries
Click on add External jar button
Browser your jar file
Add the file from the system.

As Piotr said, I didn't understand the problem. However, here is how you can add a jar file in eclipse.
Right-click on your project Build path -> Configure Build Path...
Select Library tab There you can see on the right-hand side, Add
JARs... or Add External JARs...
Select what do you want.

Copy the jars and paste them into your lib directory for web applications
lib location :
YourProject
--WebContent
---WEB-INF
---lib

Related

Zip Referenced Libraries into Eclipse project

I have no experience with package structure. I added two external libraries (from Joda) to my eclipse project. The code makes use of the libraries with no problems. However, when I export the Archived File and open it on another computer, the libraries are no where to be found. Much sadness.The error looks like a little red exclamation point next to my project in the package explorer. Checkboxes next to the libraries have been checked/applied.
Right click on your project
Navigate to build paths -> configure build path
In order and export tab check whether the library is in the list or not
If it is not selected, tick the Checkbox and click apply
Someone told me that I need to export it as a executable jar.

How to link an external jar file in two java projects

ok guys, I'm trying to import the jfugue android port library into a libdx project, but I don't know how to add the jar files from the core project to the android one, since they don't appear as jar in the add jar option in the android build path project.
The jar file you're pointing to is an external jar (you can see it has a full path), so add to the other project using "Add External JARs" button on the "Libraries" tab of the "Java Build Path" page of the project's properties dialog.
Step-1>Just copy the jar files from Quintas_analizer project and paste
them in libs folder of Quintas_analizer-android. Then right click on
the jar files in Quintas_analizer-android and add to build path.
or
Step-1.1 >Another way is that-> right click Quintas_analizer-android
->properties-> Android->Add-> Select the project Quintas_analizer and add.
If Quintas_analizer not shown then go to Quintas_analizer ->
properties -> Android-> Mark the checkbox ->is a library-> Repeat step
1.1

How to add external jar file doc in eclipse?

I am using external jar file in project, but I don't have any idea how to add doc for same project in Eclipse.
I followed TIPS but it's same, nothing reflect on use of
Content assist(Ctrl-Space).
Any suggestion?
To add an external library to a project, right click the project and select
Build Path | Configure Build Path...
Hit the button:
Add External JARs...
and select the archive of your choice. Now click the small triangle, which is to the left of the archive, and select:
Javadoc location
Hit the button:
Edit...
and select once again the archive containing the JavaDoc. You may and should do the same for:
Source attachment
If you add the source archive, eclipse will generate the Javadoc on the fly for you. Hence, adding the Javadoc location is kind of obsolete. If you like to read the rendered Javadoc like in a browser, open the Javadoc View by selecting:
Windows | Show View | Javadoc
or pressing:
Alt + Shift + Q, J
Goto
Windows/Preferences
This will open a window for you. In left menu goto:
Java/Build Path/User Libraries
There on the right hand side, locate new button and create a new User Library. You can then see the Add Jars button will be enabled. You can add your jar file into your library then.
To include library into your project. Right click on your project and goto Build Path -> Add Libraries option. Add your library and use it in your project.
If jar is loaded properly so the java docs will. In order to load jar copy that into your project. In eclipse explorer right click on jar and select--> Build Path --> Add to Build Path
and its done.
Or it is better to use some build tool like maven to import external jars.
Have you configured the Preferences of Content assist through Preferences » Java » Editor » Content Assist » Advanced in Eclipse?

How to use *.jar file in a Java project?

I'm a complete novice to Java, and I'm stuck in trying to use an external jar library in a Java project I'm working on.
The library is Twitter4J (http://twitter4j.org/), a complex group of files which I can't understand how to include. I'm using Eclipse on Windows. I understood the meaning of CLASSPATH enviroment variable (or well, I think I did), but I can't understand how to link it to the Eclipse enviroment.
This blog post seemed to be what I was looking for: http://jasperpeilee.wordpress.com/2012/01/25/how-to-set-up-twitter4j-quickly-in-your-java-project/
But:
Add twitter4j-core-2.2.5.jar into project for general use.
1) Where should I copy the core file? In the /bin/ folder? Or in a completly unrelated /lib/ folder, as this question in SO stated?
Copy Twitter API property file into your project/bin directory.
2) What is the Twitter API property file?
3) How can I include JavaDoc jar files too? Is it possibile to get them into Elipse?
Any kind of help, even just a link, will be very appreciated!
You probably have a project folder for your Eclipse project. Go ahead and make a lib folder inside of your project folder, in the same directory as src and bin. There's nothing special about the lib folder specifically, it's just a convenient name. Copy the .jar file into your newly created folder. Back in Eclipse, right click your project and click Refresh. The lib folder should pop up, including your JAR! Right click the JAR file and go to Build Path --> Add To Build Path. At this point, any class in the project should be able to use Twitter4J features.
As for the What question, the Twitter API property file contains configuration that is necessary for the Twitter jar to function. The file should probably be located on the classpath of your application.
And the How question, you can attach the javadoc jar file of the Twitter jar to the Twitter jar's classpath entry in Eclipse. Right-click your project and select Properties. Go to the Java Build Path entry and find the Twitter jar under the Libraries tab. If you expand the Twitter jar entry you will see 'JavaDoc location'. You can specify the javadoc jar there.
In Eclipse, right-click your project, select Properties. Now find the entry for Java Build Path and select it. Click the "Libraries" tab if it is not already selected. Click the "Add external JARs..." button. Follow the prompts.

How do you "install" Simple in eclipse?

How do I use simple in eclipse?
Do I add it to the JDK?
http://simple.sourceforge.net
The web site seem to have allot of info on using the methods but little on setting up the library.
I have used C and C++ to set up external libraries before but the Java set up confuses me.
Thank you!
In java world, in order to be able to use third party libraries, what you need to do is to add them to your project/application's CLASSPATH. In case of Simple, its library file is simple-xml-2.4.1.jar that is located inside a folder "jar" within the simple-xml-2.4.1.zip that you would download from Sourceforge.
Download and unzip the
simple-xml-2.4.1 Archive. (ZIP file).
Note that it has a Jar folder that
contains simple-xml-2.4.1.jar - that
is the library eclipse and other IDES
would use to set up the CLASSPATH
Goto your project in project
explorer.
Right-click on the project name and
select "Properties". Alternately, you
can click on the project name and
type "Alt+Enter". A window will
pop-up.
In the window, select "Java Build
Path". You will see several tabs,
including "Source", "Projects" and
"Libraries".
To add simple-xml-2.4.1.jar to your
project, click on the "Libraries"
tab. From there, you can add either
internal jars or external jars. The
"Add External Jar" would be to add a
jar that's on your computer somewhere
. So choose that button, browse to
where simple-xml-2.4.1.jar is located
and make sure to add it to your build
path

Categories

Resources