• 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

installing ant on centos

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey i'm trying to get ant installed on my centos box
preinstalled came a ant 1.7 but now i want to upgrade it to 1.8 (just for the heck of it)
i downloaded the tarball and unpacked it in /usr/local/ant and set my system variables in the /root/.bash_profiles
however if i run ant -version i still get ant 1.7 how can i make sure my default is 1.8?

cheers
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I take it you are logging in to your CentOS box as root, and running Java that way. This will cause you problems down the line, however it is not directly related to your problem so I won't comment further at this time.

What changes did you make to your .bash_profile? Note - singular, not plural. If you changed .bash_profiles then you modified the wrong file.

Did you re-source the .bash_profile file after modifying it? That is:
 
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
Please tell us exactly what you set the system variables to, especially the PATH. Also, what do you get when you run:

which ant

If the result is /usr/bin/ant, you need to also do:

ls -al /usr/bin/ant

because it could be a softlink to the old 1.7 version.

Fun and games like this are why I never install any Java stuff using the packages that come with a disto...
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm in agreement with Peter. I am a VERY big fan of the RPM package manager, but the one place where I avoid it is for Java stuff (except for my own code). One of the reasons I do that is because the OS provider generally doesn't give you the most up-to-date version of the software. An extreme case, in fact, was Sun's Solaris 10, which came with Tomcat4 as the packaged server even though Tomcat4 had already passed End of Life (ironic, much?).

To run your own version of Ant, however, you can do this:

1. Download the desired Ant archive.

2. Explode it (I usually end up with /usr/local/apache-ant-x.y.z).

3. Set your environment variable for ANT_HOME to be the directory named in Step 2.

4. Add $ANT_HOME/bin to your PATH at the HEAD of the path (so that it will override the other Ant version). Also, of course, you need to have $JAVA_HOME/bin setup for whichever JVM Ant should be running under.

Items 3 and 4 can be done in build script or in your profile, whichever is most convenient.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic