Java, Jar and Manifest file….

META-INF/MANIFEST.MF should have Main-Class, location important:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.6.0_03-b05 (Sun Microsystems Inc.)
Main-Class: folder/another/me/control/RunEngine
Built-By: gert

this was done by:

c:\javacodefolder\>ant jar

with build.xml:

<property name="name" value="trains" />
<!-- JAR -->

<target name=”jar” depends=”compile” description=”Deploy application as a JAR file”>
<jar destfile=”${name}.jar”>
<fileset dir=”${build.home}” />
<manifest>
<attribute name=”Main-Class” value=”folder/another/me/control/RunEngine” />
<attribute name=”Built-By” value=”${user.name}”/>
</manifest>
</jar>
</target>

and to run:

c:\javacodefolder>java -jar trains.jar

or to Double-Click in Windows on it,

Explorer->Tools->Folder Options…->File Types->JAR

Advanced->open->Edit…->Application used to perform action:

"C:\xxx\jdk1.6.0_03\bin\javaw.exe" -jar "%1"

and nothing behind it…

c:>set

ANT_HOME=c:\ant
CLASSPATH=.;C:\Java_\jdk1.6.0_03
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\gert
JAVA_HOME=C:\Java_\jdk1.6.0_03
Path=C:\xxx\jdk1.6.0_03\bin;c:\ant\bin;c:\perl\bin\;
C:\WINDOWS\system32;
C:\WINDOWS;c:\gtk\2.0\bin;
ProgramFiles=C:\Program Files
PROMPT=$P$G
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=c:\temp
TMP=c:\temp
USERNAME=gert
windir=C:\WINDOWS

Advertisements

~ by nambabwe on 2007/11/25.

 
%d bloggers like this: