Skip to main content



      Home
Home » Newcomers » Newcomers » Java Build Path
Java Build Path [message #833475] Sat, 31 March 2012 10:55 Go to next message
Eclipse UserFriend
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 11:04 Go to previous messageGo to next message
Eclipse UserFriend
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 12:20 Go to previous message
Eclipse UserFriend
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: Mon Jul 07 15:26:34 EDT 2025

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

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

Back to the top