• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

User Defined Variables in Eclipse

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi , I know about Classpath Varibles .
Please tell me about User Variables .
What is the use of User Defined Variables in Eclipse ?

Thanks in advance.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A classpath variable lets you define a location on your system, and later use that variable to define the locations of JAR files. Where this helps is that if you are working on a team with other developers, each developer could have his or her JAR files located in diverse places, yet you can all easily share the same projects.

For example, on my Windows system at home I have my local Maven repository at d:/opt/m2_repo. Within Eclipse I define a classpath variable, M2_REPO, and set it to "d:/opt/m2_repo". Then when I want to include the commons loggin JAR in my app's classpath, I add it as "${M2_REPO}/common-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar". At work, my local Maven repository is located at f:/opt/m2_repo. So there I set the classpath variable M2_REPO to "f:/opt/m2_repo". Then I can easily use the same project at home or work because the project uses the classpath variable, and not the hard-coded name.

Similarly, my coworkers can use the same project without change by properly setting M2_REPO for their environment. Even when running on Linux, it still works fine - there I set M2_REPO to "/opt/m2_repo".

I find this feature so handy that I use it all the time. In fact, I curse Eclipse every time it demands a hard-coded directory file name (for example, when locating javadocs or source code) and wonder why this ability to use user-defined locations is not available for every setting.
 
reply
    Bookmark Topic Watch Topic
  • New Topic