Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Existing JAR in source code 2

Status
Not open for further replies.

k4ghg

Technical User
Joined
Dec 25, 2001
Messages
192
Location
US
Hi

I found a JAR file that includes classes that I need for my project. How can I use/incorporate an existing JAR into my code? Do I need to extract all the files and then recompile them or can I get by with some simple import function?

Thanks Ronnie
 
add the jar into your classpath
then import the package
 
on windows :

set CLASSPATH=%CLASSPATH%;C:\java\myjar.jar

or unix :

export CLASSPATH=$CLASSPATH:/usr/local/myjar.jar
 
and of course import the relevant classes :

import com.acme.stuff.*;
 
Thanks...Ronnie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top