Meaningless Drivel is fun!*
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
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Detecting java , ant script needed" Watch "Detecting java , ant script needed" New topic
Author

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??
Thanks


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

Joined: Mar 22, 2005
Posts: 41868
    
  63
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: 16065
    
  21

Unix/Linux:

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