Skip to main content

Launching Ant Inside Java Program

Most of the time, we need to embed Ant in a java program. So if you need to call Ant task inside Java program, this piece of code will do it.

Required Jars:

Ant.jar
Ant-Launcher.jar
tools.jar*


you can get the jar file by just using the class org.apache.tools.ant.launch.Launche through this Jar finder Website


Source Code:

import org.apache.tools.ant.launch.Launcher;

public class LaunchAnt
{
public static void main(String args[])
{
String[] parameters = new String[2];

parameters[0]="-buildfile";

parameters[1] = "build.xml";

Launcher.main(parameters);

}

}


Note:
tools.jar will be available at the location

C:\ProgramFiles\ - Windows

usr/lib/jvm/ - Linux


Install Java in Linux

Comments

Anonymous said…
Very Informative.
Thanks for Sharing

Popular posts from this blog

HQL to SQL Convertor

Stepping in to the field of java API. Presenting you my first invention HQL to SQL convertor. This is a Command line version with which you can convert simple Hibernate query language(HQL) to Structured Query Language.

This is my first release and not an exception for bugs and errors. If you find any errors, please feel free to inform me. Your suggestion are valuable.

Usage :

java -jar HQLtoSQLConvertor.jar

Example:

java -jar HQLtoSQLConvertor.jar "from Syndrome"

HQL to SQL Convertor

Difference Between Cloudy Vision and Blurred Vision

Blurred Vision:

If the Sharpness of the Image goes of, its blurred Vision. The image appears like its is not Clear and details wont be clear enough to analyze what is what. In the worst case, the Shape of the Image goes blurred, even a Cow appear as an ATM Machine

Cloudy Vision:

Cloudy vision means
Consider a glass of water , add a drop of Milk in it.
Then see how it looks.
That is how you would see the world. The whole thing is clear but you would see a Mild Screen.

Recover Data from Damaged Hard Disk

Nero 9

Yes. At least that is what it claims. Anybody using Nero 9, please update how efficient is this feature.

Nero BackItUp & Burn lets you:

* Perform tasks quickly and intuitively in just a few steps
* Back up data to hard drive, CD, DVD, Blu-ray Disc, FTP, memory card,
and online storage*
* Rely on automatic backups to local hard drives and online storage
* Schedule backup jobs with flexibility and convenient e-mail confirmation
* Burn discs with the world's most reliable burning application
* Create audio CDs, copy DVDs, and Blu-ray Discs
* Sync all your files and folders for easy access to the latest versions
* Recover data from deleted and damaged storage media
* Restore files, folders, drives, and entire systems
* Enjoy the Nero Online Backup trial and get 1 GB storage space for 3
months FREE

Please define the storage media. Can it retrieve data ( at least partially) from a damaged CD/DVD.

(A Direct quote from Nero)