双击可执行Jar文件没反应---我没辙
源文件:
/*
* Created on 2005-3-30
*/
package a.b;
/**
* @author Mituzhishi
*/
public class Ch05_02 {
public static void main(String[] args) {
System.out.println("This code was built using Ant.");
}
}
build.xml:
<?xml version="1.0"?>
<!-- ===================================================================== -->
<!-- My test -->
<!-- Ant 1.6.2 build file -->
<!-- ===================================================================== -->
<project name="test" default="build" basedir=".">
<property name="srcdir" value="a"/>
<property name="destdir" value="build"/>
<property name="docdir" value="doc"/>
<!-- Allow user to override properties without editing this file -->
<property file="${user.home}/.ant.properties" />
<!-- ================================================================= -->
<!-- Compile -->
<!-- ================================================================= -->
<target name="compile" description="Compiles the source code for my project">
<mkdir dir="${destdir}"/>
<javac srcdir="${srcdir}"
destdir="${destdir}"
debug="on" >
<include name="**/*.java"/>
</javac>
</target>
<!-- ================================================================= -->
<!-- Clean -->
<!-- ================================================================= -->
<target name="clean" description="Deletes the build directory for my project">
<delete dir="${destdir}" failonerror="false" />
</target>
<!-- =================================================================== -->
<!-- Build -->
<!-- =================================================================== -->
<target name="build" depends="clean, compile" description="Compiles and creates the Jar file">
<jar jarfile="${basedir}/test.jar">
<manifest>
<attribute name="Main-Class"
value="a.b.Ch05_02"/>
</manifest>
<fileset dir="${destdir}" includes="**/*.class"/>
</jar>
</target>
<!-- =================================================================== -->
<!-- Javadoc -->
<!-- =================================================================== -->
<target name="javadoc" description="Creates API documentation (JavaDocs) for my project">
<delete dir="${docdir}" failonerror="false"/>
<mkdir dir="${docdir}"/>
<javadoc
destdir="${docdir}"
access="private"
author="true"
version="true"
use="true">
<fileset dir="${srcdir}">
<include name="*.java"/>
</fileset>
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
</javadoc>
</target>
</project>
manifest:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.4.2-b28 (Sun Microsystems Inc.)
Main-Class: a.b.Ch05_02
最终生成的Jar文件中有a.b.Ch05_02.class这个文件
可是双击就是没反应,
我以前做的可执行Jar文件都可以的
怀疑是源文件中使用了包的缘故