2012-01-21 14 views
0

私は、依存ライブラリを含めるためにさまざまな方法を試しました。しかしAntビルドファイルとライブラリ

  <?xml version="1.0" encoding="UTF-8"?> 
      <project name="IvleFileSync" default="dist" basedir="."> 
      <description> 
       simple example build file 
      </description> 
      <!-- set global properties for this build --> 
      <property name="src" location="src"/> 
      <property name="build" location="build"/> 
      <property name="dist" location="dist"/> 

     <path id="files-classpath"> 
      <fileset dir="/usr/lib" > 
       <include name="*.jar"/> 
      </fileset> 
     </path> 

      <target name="init"> 
      <!-- Create the time stamp --> 
      <tstamp/> 
      <!-- Create the build directory structure used by compile --> 
      <mkdir dir="${build}"/> 
      </target> 

      <target name="compile" depends="init" 
       description="compile the source " > 
      <!-- Compile the java code from ${src} into ${build} --> 
      <javac srcdir="${src}" destdir="${build}"/> 
      <classpath> 
       <path refid="files-classpath" /> 
       <path location="/usr/lib/swing-layout-1.0.3.jar"/> 
       <path location="/usr/lib/swing-worker-1.1.jar"/> 
       <path location="/usr/lib/appframework-1.03.jar"/> 
      </classpath> 

      </target> 

      <target name="dist" depends="compile" 
       description="generate the distribution" > 
      <!-- Create the distribution directory --> 
      <mkdir dir="${dist}/lib"/> 

      <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> 
      <jar jarfile="${dist}/lib/IvleFileSync-${DSTAMP}.jar" basedir="${build}"/> 
      </target> 

      <target name="clean" 
       description="clean up" > 
      <!-- Delete the ${build} and ${dist} directory trees --> 
      <delete dir="${build}"/> 

思いません:これは私のビルドファイルである

appframework-1.03.jar、スイングworker.jarとスイングレイアウト瓶

私のプロジェクトが依存しますソースをコンパイルすることができます

常にパッケージorg.jdesktop.applicationが存在しませんエラーをスローします。

私はあなたは、そのクラスパスを定義する前に、javacタスクを閉じ

答えて

3

"USR/libに/" の下にすべての私のjarファイルを入れている:

<javac srcdir="${src}" destdir="${build}"/> 
<classpath>... 
              ^-- javac is closed here. 

<javac srcdir="${src}" destdir="${build}"> 
    <classpath>...</classpath> 
</javac> 

とそれを交換してありますクラスパスにjarを2回追加する必要はありません。あなたは一度<path refid=を使用してそれらを含め、次にJARを一覧表示することでもう一度それらを含めます。

+0

これは素晴らしいですね!ありがとう! – redDragonzz

関連する問題