Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

installing ant on centos

 
Jeroen Nouws
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11888
203
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • 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:
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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...
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18214
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic