wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Detecting java , ant script needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Detecting java , ant script needed" Watch "Detecting java , ant script needed" New topic

Detecting java , ant script needed

Jas Oberai
Ranch Hand

Joined: Jan 16, 2005
Posts: 231
Hi Friends,
I have a ant based installer. Now,I want to write an ant script that should detect if java is already installed on the system or not.If not, it should try to install java that is there with the installer package.
So,any help as to how to accomplish this??

SCJP 1.4 (88%)<br />SCWCD 1.4 (88%)
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41052
Since Ant needs Java to run, it would be quite a miracle to get it to install Java if it isn't installed already

Ping & DNS - my free Android networking tools app
Jas Oberai
Ranch Hand

Joined: Jan 16, 2005
Posts: 231
Thanks for your reply.I can try some other way to detect java for eg, I could run a batch script to start with,that should check to see if java is there or not.

If yes,launches the ant installer otherwise starts java installation.

Is that feasible?Any help on that??
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950


java -version >/dev/null || install-java.sh

Of course, if Java isn't installed, you probably didn't have an install-java sehll script either.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link: http://aspose.com/file-tools
subject: Detecting java , ant script needed
Similar Threads
OracleTypes error while Migrating app in Java 6 with Weblogic 10.3.4 server
Javadoc question
return calculcatedValue to ant script from Java class
dll in a Jar File