This commit is contained in:
jrandom
2005-09-16 04:34:59 +00:00
committed by zzz
parent d89f589f2b
commit 6ca3f01038
102 changed files with 9297 additions and 0 deletions

View File

@@ -0,0 +1 @@
build

Binary file not shown.

View File

@@ -0,0 +1,59 @@
<project name="ConsoleApp" default="exe" basedir=".">
<property name="src" location="src"/>
<property name="lib" location="lib"/>
<property name="build" location="build"/>
<property name="launch4j.dir" location="../.." />
<path id="dist.classpath">
<pathelement path="${build}"/>
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init" description="compile the source">
<javac srcdir="${src}" destdir="${build}" classpathref="dist.classpath" debug="on"/>
</target>
<target name="jar" depends="compile" description="create the jar">
<fileset dir="${lib}" id="lib.dist.fileset">
<include name="**/*.jar"/>
</fileset>
<pathconvert pathsep=" " property="dist.classpath" refid="lib.dist.fileset">
<map from="${lib}" to=".\lib"/>
</pathconvert>
<!-- Put everything in ${build} into a jar file -->
<jar jarfile="${ant.project.name}.jar">
<fileset dir="${build}" includes="**/*"/>
<manifest>
<!-- SET YOUR MAIN CLASS HERE -->
<attribute name="Main-Class" value="net.sf.launch4j.example.ConsoleApp"/>
<attribute name="Class-Path" value=". ${dist.classpath}"/>
</manifest>
</jar>
</target>
<target name="exe" depends="jar">
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar
:${launch4j.dir}/lib/xstream.jar" />
<launch4j>
<config headerType="1" jar="ConsoleApp.jar" outfile="ConsoleApp.exe"
errTitle="ConsoleApp" chdir="." customProcName="true" icon="l4j/ConsoleApp.ico">
<jre minVersion="1.4.0" />
</config>
</launch4j>
</target>
<target name="clean" description="clean up" >
<delete dir="${build}"/>
<delete file="${ant.project.name}.jar"/>
<delete file="${ant.project.name}.exe"/>
</target>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,8 @@
Put your jar libs here and the build script will include them
in the classpath stored inside the jar manifest.
In order to run your application move the output exe file from
the dist directory to the same level as lib.
SimpleApp.exe
lib/
lib/xml.jar

View File

@@ -0,0 +1 @@
To build the example application set JAVA_HOME and ANT_HOME environment variables.

View File

@@ -0,0 +1,57 @@
/*
launch4j :: Cross-platform Java application wrapper for creating Windows native executables
Copyright (C) 2005 Grzegorz Kowal
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.sf.launch4j.example;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @author Copyright (C) 2005 Grzegorz Kowal
*/
public class ConsoleApp {
public static void main(String[] args) {
StringBuffer sb = new StringBuffer("Hello World!\n\nJava version: ");
sb.append(System.getProperty("java.version"));
sb.append("\nJava home: ");
sb.append(System.getProperty("java.home"));
sb.append("\nCurrent dir: ");
sb.append(System.getProperty("user.dir"));
if (args.length > 0) {
sb.append("\nArgs: ");
for (int i = 0; i < args.length; i++) {
sb.append(args[i]);
sb.append(' ');
}
}
sb.append("\n\nEnter a line of text, Ctrl-C to stop.\n\n>");
System.out.print(sb.toString());
try {
BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
String line;
while ((line = is.readLine()) != null) {
System.out.print("You wrote: " + line + "\n\n>");
}
is.close();
} catch (IOException e) {
System.err.print(e);
}
}
}