Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How can I use ant to run a java application?



How can I use ant to run a java application?..

Answer / Rahul Sharma

To run a Java application using Ant, create a target in your build.xml file that runs the `java` task with the main class and any required arguments. Here's an example:

```xml
<project name="My Project" default="run">
<target name="run">
<java fork="yes" classname="com.mypackage.MainClass">
<arg value="-Dargument1=value1"/>
<arg value="-Dargument2=value2"/>
<!-- additional arguments go here -->
</java>
</target>
</project>
```
In this example, the `run` target forks the JVM and runs the MainClass located in com.mypackage with specified command-line arguments.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Apache Ant Interview Questions

How can I use ant to run a java application?

1 Answers  


How you can explain ant property?

1 Answers  


Which version of java is required to run ant?

1 Answers  


How we can set the path environment variable of ant?

1 Answers  


How to use ant-contrib tasks?

1 Answers  


Explain how to use clean in ant script?

1 Answers  


How we can echo message in ant?

1 Answers  


Explain the concepts of ant?

1 Answers  


How you can clean or delete workspace using ant?

1 Answers  


How we can set compile target using ant?

1 Answers  


Why ant is a great build tool?

1 Answers  


What is built-in properties? And how many built-in properties?

1 Answers  


Categories