Permalink
Browse files

add main class and manifest

  • Loading branch information...
shrimpza committed Jul 11, 2015
1 parent f7cb5aa commit 7425d635cfc68444e1abbc4b16ddf2ccb83337f0
Showing with 22 additions and 0 deletions.
  1. +7 −0 part02/build.xml
  2. +15 −0 part02/src/net/shrimpworks/ant/Main.java
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="hello-world" default="dist" basedir=".">

<!-- for a runnable jar file, add the main class name -->
<property name="main.class" value="net.shrimpworks.ant.Main"/>

<!-- basic paths -->
<property name="src.dir" location="src"/>
<property name="dist.dir" location="dist"/>
@@ -27,6 +30,10 @@
<mkdir dir="${dist.dir}"/>

<jar jarfile="${dist.dir}/${ant.project.name}.jar">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>

<fileset dir="${build.src.dir}"/>
<fileset dir="${src.dir}" excludes="**/*.java"/>
</jar>
@@ -0,0 +1,15 @@
package net.shrimpworks.ant;

/**
* Application's main class.
*/
public class Main {

public static void main(String... args) {
// create a hello world instance...
HelloWorld hw = new HelloWorld();

// ... and use it to print Hello World.
System.out.println(hw.helloWorld());
}
}

0 comments on commit 7425d63

Please sign in to comment.