ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karin Lagesen <karin.lage...@labmed.uio.no>
Subject build.xml jar target problem
Date Tue, 08 Jul 2003 10:44:12 GMT
I am sorry if the problem I am having is not an ant problem, but I
thought I'd try here anyway...:)

I use ant to make my manifest file when making jar files. The produced
manifest file seems ok, I cannot run the jar file.

Manifest file produced:

Manifest-Version: 1.0
Created-By: Apache Ant 1.5.1
Built-By: karinlag
Main-Class: no.uio.labmed.InterGene


The error I get when I try to run the jar file:

uracil:10:39> java -jar dist/jar/InterGene.20030708.jar
no.uio.labmed.InterGene
Exception in thread "main" java.lang.NoClassDefFoundError:
no/uio/labmed/InterGe
ne

My build file (sorry if this message gets large...)


<?xml version="1.0" encoding="iso-8859-1"?>
<project name="InterGene" default="build">

  <!-- URL to Java 2 API documentation --> 
  <property name="apiurl" value="http://java.sun.com/products/jdk/1.4/docs/api"/> 

  <!-- Directories -->
  <property name="src"          value="${basedir}/src"/>     <!-- Source -->
  <property name="lib"          value="${basedir}/lib"/>     <!-- External packages/jar
files -->
  <property name="build"        value="${basedir}/build"/>   <!-- Build directory
-->
  <property name="classes"      value="${build}/classes"/>   <!-- Compiled source
files -->
  <property name="doc"          value="${basedir}/doc"/>     <!-- Documentation -->
  <property name="javadoc"      value="${doc}/javadoc"/>     <!-- Javadoc documentation
-->
  <property name="dist"         value="${basedir}/dist"/>    <!-- Distro = jar, source
and doc -->
  <property name="jar"          value="${dist}/jar"/>        <!-- Jar file directory
-->

  
  <!-- Initialization -->
  <target name="init">
    <tstamp/>
    <mkdir dir="${build}"/>
    <mkdir dir="${classes}"/>
    <mkdir dir="${doc}"/>
    <mkdir dir="${javadoc}"/>
    <mkdir dir="${dist}"/>
    <mkdir dir="${jar}"/>
  </target>

  <!-- Copy icons -->
  <target name="icons" depends="init">
    <copy todir="${build}/icons">
      <fileset dir="${basedir}" includes="icons/*.gif"/>
    </copy>
  </target>
  
  <!-- Build all classes -->
  <target name="build" depends="init,icons">
     <javac srcdir="${src}" destdir="${classes}"/>
  </target>


  <!-- Build documentation -->
  <target name="javadoc" depends="init">
    <javadoc sourcepath="${src}" destdir="${javadoc}"
      access="public"
      packagenames="no.uio.labmed.*">
      <link href="${apiurl}"/>
    </javadoc>
  </target> 

  <!-- Build jar file -->
  <target name="jar" depends="init,icons,build">
    <jar jarfile="${jar}/${ant.project.name}.${DSTAMP}.jar">
      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
        <attribute name="Main-Class" value="no.uio.labmed.InterGene"/>
      </manifest>
      <fileset dir="${build}" includes="**/*.class"/>
      <fileset dir="${build}" includes="**/*.gif"/>
    </jar>
  </target>

  <!-- Build distro -->
  <target name="dist" depends="init,icons,build,javadoc,jar">
    <copy todir="${dist}/javadoc">
      <fileset dir="${javadoc}" includes="**/*"/>
    </copy>
  </target>

  <!-- Clean up -->
  <target name="clean">
    <delete dir="${build}"/>
    <delete dir="${doc}"/>
    <delete dir="${dist}"/>
  </target>

</project>

TIA,
 
Karin
-- 
Karin Lagesen, PhD student
karin.lagesen@labmed.uio.no

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message