Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Java Build Path
Java Build Path [message #833475] Sat, 31 March 2012 14:55 Go to next message
wws_ques wws_ques is currently offline wws_ques wws_quesFriend
Messages: 64
Registered: July 2009
Member
I have an annoying question that has bothered me for a while. Due to some reason, I need to work on a project in different environments. So, when I switch to a new environment, I need to manually remove the existing jar files and then add these jar files in the new location. I am just wondering whether eclipse provides a simple/single way to specify the dir which contains the required jar files so I dont need to manually add them when switching to a new environment.
Thanks.
Bill
Re: Java Build Path [message #833481 is a reply to message #833475] Sat, 31 March 2012 15:04 Go to previous messageGo to next message
Olivier Thomann is currently offline Olivier ThomannFriend
Messages: 518
Registered: July 2009
Senior Member
Hi,

You should use a classpath variable. Set it to the directory that contains the jar and you just need to update the classpath variable in each environment that you are using.
Go to:
Preferences>Java>Build Path>Classpath Variables.
Add your variable there and then in your project, you select: Build Path>Configure Build Path>Libraries.
Do "Add Variable...", select your variable and then click on "Extend...".

Once you set up the classpath variable value in each of your environment, you will never need to change your classpath anymore. The paths to your jars will be updated automatically to the right location in each environment.

Hope this help.

Olivier
Re: Java Build Path [message #833515 is a reply to message #833475] Sat, 31 March 2012 16:20 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 2012.03.31 8:55, wws_ques wws_ques wrote:
> I have an annoying question that has bothered me for a while. Due to
> some reason, I need to work on a project in different environments. So,
> when I switch to a new environment, I need to manually remove the
> existing jar files and then add these jar files in the new location. I
> am just wondering whether eclipse provides a simple/single way to
> specify the dir which contains the required jar files so I dont need to
> manually add them when switching to a new environment. Thanks.
> Bill

I use this solution:

Copy your JARs to a subdirectory of your project, lib or
WebContent/WEB-INF/lib, then use Build Path -> Configure Build Path ->
Libraries -> Add JARs to add these JARs.

Why this works:

This sets up project-relative paths in <project>/.classpath that will
always be correct. I use Git, but have used Subversion and other
version-control software to share my project with other members of a
development team, each with his or her own "environment" as you say.
This solution works every time.

Last, if you use Ivy or Maven, this will be less of a problem.
Previous Topic:Can't install EMF in Eclipse 3.7.2
Next Topic:Does Eclipse store any information out of its directory?
Goto Forum:
  


Current Time: Fri Apr 26 08:30:20 GMT 2024

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

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

Back to the top