This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

CLASSPATH, ANT

 
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
How can one set their CLASSPATH, to be more specific to their development environment (towards a particular project) rather than appending all the jar files in the global environmental variable (I heard that setting it to the global environmental variable was never a good idea, because the same class, developed by two different programmers, can co-exist, with the same name, by accident)?
I heard that Ant solves this problem, greatly... I will be very grateful, if anyone can provide me with a small fragment of code, regarding what to place in build.xml....
-Unnsse
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is probably my favorite aspect of Ant. It makes classpaths so easy. Here is an example.

In the above example we are using a previously defined property (lib) as the directory to include in the classpath and we are including all jars in that directory. For a good beginner's tutorial on Ant, see Thomas Paul's article in the March edition of the JavaRanch newsletter.
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Matthew,
Is this particular lib directory, also, the correct place to put junit.jar?

-Unnsse
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's whats great about it. It doesn't matter where you put the jars you need in your classpath. All you need to do is point Ant to where they are in the classpath element. You may either set a property (such as lib) in the previous example or point to them directly.
 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!