LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-28-2008, 12:34 AM   #1
yuubouna
LQ Newbie
 
Registered: Jan 2007
Posts: 10

Rep: Reputation: 1
Smile how to add external jars, Java program with Reference Libraries


I have a Java program, that reference to external libraries.

for e.q.
Sample.java reference to:
poi-scratchpad-3.5-beta3-20080926.jar

I am not sure where to put the reference library and setting up.
Do I need to add that also in Path settings?


Cheers,
jackie
 
Old 11-28-2008, 04:15 AM   #2
yuubouna
LQ Newbie
 
Registered: Jan 2007
Posts: 10

Original Poster
Rep: Reputation: 1
I made my java programs run by including unzip jar files of:
poi-3.5-beta3-20080926.jar, in order to reference the class files my Java program required.


My directory structured looks like the ff:
/home/me/poi
[org] - directory where poi-3.5-beta3-20080926.jar unzip files where located
Sample.java - java files that reads the

But I think this setting not flexible.

Anybody knows how to make a reference to a jar files?

jackie
 
Old 11-28-2008, 04:56 AM   #3
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
You need to place the jar on your classpath. To do so, open your .(bash)_profile or your /etc/profile and add
export CLASSPATH=/path/to/jar:$CLASSPATH
You will then need to source the file in question or log out and back in.
 
Old 11-30-2008, 10:19 PM   #4
yuubouna
LQ Newbie
 
Registered: Jan 2007
Posts: 10

Original Poster
Rep: Reputation: 1
Thumbs up

Hello Jay, thanks!
Yes, exactly that`s what I did.

I found that my classpath settings mistakes in calling the Apache Poi JAR files.
Changing it in order to call the JARs solved my problems.

in my .bash_profile, I append the following:
export APACHE_POI=/home/me/poi-3.5-beta3 ---> (Here where JAR`S Files are located.)
export PATH=$APACHE_POI:$PATH
export CLASSPATH=$CLASSPATH:$APACHE_POI

checking to see if its set:
set
then,

....
CLASSPATH=:/usr/local/jdk1.6.0_10/lib:/home/me/poi-3.5-beta3
PATH=/home/me/poi-3.5-beta3:/usr/local/jdk1.6.0_10/bin
....

APACHE_POI classpath where now setup, properly.
I don`t need either the unzip files of the Jars located in /home/me/poi-3.5-beta3.



(^-^)/ Cheers,
jackie

Last edited by yuubouna; 11-30-2008 at 10:22 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java and Jars ? EAD Programming 6 12-31-2006 03:10 PM
Undefined reference in C++ program Komakino Programming 3 12-03-2006 05:42 PM
Undefined reference to WxGtk libraries when compiling Xchm Darwish Linux - Software 0 09-04-2005 12:11 AM
how can i add all installed fonts in my java program? sanjeebko Programming 0 08-15-2005 07:16 PM
Program not finding java VM libraries gtanghookup Linux - Software 5 09-04-2003 02:20 AM


All times are GMT -5. The time now is 03:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration