Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Relative Path for adding jar files?
Relative Path for adding jar files? [message #266970] Tue, 09 December 2008 13:22 Go to next message
Piyush Soni is currently offline Piyush SoniFriend
Messages: 20
Registered: July 2009
Junior Member
Hi,
I'm adding some third party jar files in my project and want to distribute
my project along with the jar files to some people. But the problem is,
when I add the jar files in my project, the classpath copies the absolute
path of the files, which will of course not work on some other machine if
he doesn't copy the files at the exact same location.

How to make eclipse to add a path relative to my project?

Thanks !
Re: Relative Path for adding jar files? [message #266974 is a reply to message #266970] Tue, 09 December 2008 13:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: 4cs6fcg02.sneakemail.com

Piyush Soni schreef:
> Hi,
> I'm adding some third party jar files in my project and want to
> distribute my project along with the jar files to some people. But the
> problem is, when I add the jar files in my project, the classpath copies
> the absolute path of the files, which will of course not work on some
> other machine if he doesn't copy the files at the exact same location.
>
> How to make eclipse to add a path relative to my project?

I put jar files directly in the root of my project. This makes the
..classpath file system independent and suitable for version control. It
is a bit more troublesome to have source and javadoc locations relative
as well. Along with that you can add *.jar to svn:ignore (or whatever
system you’re using).

H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Re: Relative Path for adding jar files? [message #266976 is a reply to message #266970] Tue, 09 December 2008 14:04 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Where exactly do you put these jars? If you put them somewhere inside
your project, e.g. in a directory named 'libs', and add them to the
build-path, the classpath entry should be relative to your project root.
To add a jar, simply rightclick it and select 'Add to build-path'.

Felix
Re: Relative Path for adding jar files? [message #266979 is a reply to message #266976] Tue, 09 December 2008 16:17 Go to previous messageGo to next message
Piyush Soni is currently offline Piyush SoniFriend
Messages: 20
Registered: July 2009
Junior Member
Hi,
I'm doing exactly the same. I have created a folder called 'lib' in my
root project folder, which has others like .settings, bin, src folders at
the same level.

And I added these .jar files by clicking 'configure build path' and doing
an 'add external jars'

It did not take relative path.
Re: Relative Path for adding jar files? [message #266981 is a reply to message #266979] Tue, 09 December 2008 16:24 Go to previous messageGo to next message
Piyush Soni is currently offline Piyush SoniFriend
Messages: 20
Registered: July 2009
Junior Member
Got it. I had to click 'Add jars' after refreshing the project. Earlier I
was not seeing anything in the add jar button because I had not refreshed
the project to show my lib folder.

Thanks for your help.
Re: Relative Path for adding jar files? [message #266983 is a reply to message #266970] Tue, 09 December 2008 18:46 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 12/9/2008 8:22 AM, Piyush Soni wrote:
> Hi,
> I'm adding some third party jar files in my project and want to
> distribute my project along with the jar files to some people. But the
> problem is, when I add the jar files in my project, the classpath copies
> the absolute path of the files, which will of course not work on some
> other machine if he doesn't copy the files at the exact same location.
>
> How to make eclipse to add a path relative to my project?

If you did not want to include the JARs in your project, you could use a
User Library or Classpath Variable to allow each user to specify their
location on his own machine. Here is the relevant Help page:
http://help.eclipse.org/ganymede/topic/org.eclipse.jdt.doc.u ser/reference/preferences/java/ref-preferences-build-path.ht m

Hope this helps,
Eric
Previous Topic:Disable current line number display?
Next Topic:Running Eclipse on Vista-64
Goto Forum:
  


Current Time: Thu Apr 18 01:28:04 GMT 2024

Powered by FUDForum. Page generated in 0.03204 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top