Example: Build a Java application with Eclipse and Ant

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Code Generator > Generating Java code >

Example: Build a Java application with Eclipse and Ant

This example walks you through the steps required to generate a Java application with MapForce, and compile it outside of MapForce using the Eclipse Integrated Development Environment (IDE) and Apache Ant. After completing this example, you will have created and compiled a complete Java application which executes one of the mapping samples available by default in MapForce.

 

If you can already compile successfully other Java applications with Eclipse and Ant, there are no special requirements to run this example. Otherwise, note the following prerequisites:

 

The Java Development Kit (JDK), Eclipse (https://www.eclipse.org/), and Ant (http://ant.apache.org/) must be installed on your system. Eclipse typically includes support for building projects with Ant (see also Building the project with Ant ).
The Windows PATH environment variable must include the path to the JDK's bin directory (for example, C:\Java\jdk1.7.0\bin). This is a basic requirement for developing applications for the Java platform. For instructions, see http://docs.oracle.com/javase/tutorial/essential/environment/paths.html.

 

This example uses the following configuration:

 

JDK 1.7
Eclipse IDE for Java Developers (Luna Service Release 4.4.1)
Ant 1.9.2, which is already integrated into the above-mentioned edition of Eclipse; therefore, it was not installed and configured separately.

 

The example is organized into the following sub-tasks:

 

Step 1: Generate Java Code
Step 2: Import the Project into Eclipse
Step 3: Run the Project as GUI Application
Step 4: Run the Project as Console Application
Step 5: Build the JAR file with Ant

© 2019 Altova GmbH