Your buildfile is correct, but your call for start is not.
While compiling you have included Tidy.jar (${includeJar}), but you havent
when starting TidyTest.jar.

1) add the classpath when starting via "java -jar" or
2) support a classpath entry for the manifest file of TidyTest.jar


Jan

> -----Ursprüngliche Nachricht-----
> Von: THUFIR HAWAT [mailto:[EMAIL PROTECTED]
> Gesendet am: Donnerstag, 3. Februar 2005 09:44
> An: user@ant.apache.org
> Betreff: error: ...class definition existed..can no longer be found ?
> 
> Is the source of this error due to build.xml?
> 
> 
> 
> ////////////build.xml////////////////
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <project name="jtidy test" default="package">
> 
>       <property name="destdir"
>       value="C:\java\classes\" />
>       <property name="sourcedir"
>       value="C:\java\sources\atreides\jtidy\" />
>       <property name="includeJar"
>       value="C:\java\sources\org\w3c\tidy\Tidy.jar" />
>       <property name="mainClass"
>       value="TidyTest" />
> 
>       <target name="clean">
>               <delete dir="${destdir}" />
>       </target>
> 
>       <target name="prepare" depends="clean">
>               <mkdir dir="${destdir}" />
>       </target>
> 
>       <target name="compile" depends="prepare">
>               <javac
>                       srcdir="${sourcedir}"
>                       destdir="${destdir}"
>                       classpath="${includeJar}"
>               />
>       </target>
> 
> 
> 
> 
>       <target name="manifest" depends="compile">
>               <manifest file="${destdir}/MANIFEST.MF">
>                       <attribute name="Main-Class" 
>                       value="atreides.monsters.${mainClass}" />
>               </manifest>
>       </target>
> 
>       <target name="package" depends="manifest">
>               <jar jarfile="${destdir}/${mainClass}.jar"
>               basedir="${destdir}"
>               manifest="${destdir}/MANIFEST.MF" />
>       </target>
> 
> </project>
> 
> 
> 
> 
> ////////////dos///////////////////
> Microsoft Windows 2000 [Version 5.00.2195]
> (C) Copyright 1985-2000 Microsoft Corp.
> 
> C:\Documents and Settings\Administrator>cd ..
> 
> C:\Documents and Settings>cd ..
> 
> C:\>set CLASSPATH=
> 
> C:\>ant
> Buildfile: build.xml
> 
> clean:
> [delete] Deleting directory C:\java\classes
> 
> prepare:
> [mkdir] Created dir: C:\java\classes
> 
> compile:
> [javac] Compiling 1 source file to C:\java\classes
> 
> manifest:
> 
> package:
> [jar] Building jar: C:\java\classes\TidyTest.jar
> 
> BUILD SUCCESSFUL
> Total time: 8 seconds
> C:\>java -jar java\classes\TidyTest.jar
> Exception in thread "main" java.lang.NoClassDefFoundError:
> atreides/monsters/T
> idyTest
> 
> C:\>
> 
> 
> ///////////////////source/////////////
> // adapted from source available at:
> // 
> <http://sourceforge.net/docman/display_doc.php?docid=1298&grou
> p_id=13153>
> 
> 
> package atreides.jtidy;
> 
> import java.io.IOException;
> import java.net.URL;
> import java.io.BufferedInputStream;
> import java.io.FileOutputStream;
> import java.io.PrintWriter;
> import java.io.FileWriter;
> import org.w3c.tidy.Tidy;
> 
> 
> 
> public class TidyTest implements Runnable {
> 
>     private String url;
>     private String outFileName;
>     private String errOutFileName;
>     private boolean xmlOut;
> 
>     public TidyTest(String url, String outFileName, String 
> errOutFileName, boolean xmlOut) {
>         this.url = url;
>         this.outFileName = outFileName;
>         this.errOutFileName = errOutFileName;
>         this.xmlOut = xmlOut;
>     }//tidyTest
> 
>     public void run() {
>         URL u;
>         BufferedInputStream in;
>         FileOutputStream out;
>         Tidy tidy = new Tidy();
> 
>         tidy.setXmlOut(xmlOut);
>         try {
>             tidy.setErrout(new PrintWriter(new 
> FileWriter(errOutFileName), true));
>             u = new URL(url);
>             in = new BufferedInputStream(u.openStream());
>             out = new FileOutputStream(outFileName);
>             tidy.parse(in, out);
>         }//try
>         catch ( IOException e ) {
>             System.out.println( this.toString() + e.toString() );
>         }//catch
>     }//run
> 
>     public static void main( String[] args ) {
> 
>       String url = "http://www.google.com/";;
>       String output = "output.txt";
>       String errorLog = "errorLog.txt";
> 
> //    TidyTest t1 = new TidyTest(url,output,errorLog,true);
> //    Thread th1 = new Thread(t1);
> //    th1.start();
>     }//main
> }//TidyTest
> 
> 
> 
> Thank you,
> 
> Thufir Hawat
> -- 
> ___________________________________________________________
> Sign-up for Ads Free at Mail.com
> http://promo.mail.com/adsfreejump.htm
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to