W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2001

Re: Need Help in running HTMLTidy

From: Gary L Peskin <garyp@firstech.com>
Date: Tue, 01 May 2001 00:56:55 -0700
Message-ID: <3AEE6C47.61409AAE@firstech.com>
To: Erik Tan <eriktan@dingoblue.net.au>
CC: html-tidy@w3.org
Erik -

You need to add jtidy-04aug2000r6/build/Tidy.jar to the CLASSPATH
environment variable.

HTH,
Gary

> Erik Tan wrote:
> 
> Hi everyone
> 
> Could you all offer me some pointers.I have read through the archives,
> and message columns. Due to my dumbness...i still can't run HTMLtidy
> 
> My application domain is solaris unix, and java version is JDK1.2.2
> upon downloading the package jtidy-04aug2000r6.zip ,
> i unzip and set the environment to it.
> 
> my environemnt variable are as follows
> setenv JAVA_HOME
> /home/k/kitan/HTMLTidy/jtidy-04aug2000r6/build/Tidy.jar
> setenv PATH
> /home/k/kitan/HTMLTidy/jtidy-04aug2000r6/build/Tidy.jar:$PATH
> 
> 
> 1)when i try compling the sample java file Test16.java from
> sourceforge.com
> 
> Erik(010501)(5:41am)[~/HTMLTidy]>javac Test16.java
> Test16.java:7: Class org.w3c.tidy.Tidy not found in import.
> import org.w3c.tidy.Tidy;
>        ^
> 1 error
> Erik(010501)(5:42am)[~/HTMLTidy]>
> 
> steps 2
> 2)i have followed the advice from the message archive and type the
> following. it shows the config options.
> 
> java -jar jtidy-04aug2000r6/build/Tidy.jar -h
> 
> 
> i would like to know how can i run tidy from here, and how to add tidy
> into my java file
> 
> 
> Thanks in Advance
> 
> Thank You
> Erik
> 
> 
> 
> Test16.java
> 
> 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;
> 
> /**
>  * This program shows how HTML could be tidied directly from
>  * a URL stream, and running on separate threads.  Note the use
>  * of the 'parse' method to parse from an InputStream, and send
>  * the pretty-printed result to an OutputStream.
>  * In this example thread th1 outputs XML, and thread th2 outputs
>  * HTML.  This shows that properties are per instance of Tidy.
>  */
> 
> public class Test16 implements Runnable {
> 
>     private String url;
>     private String outFileName;
>     private String errOutFileName;
>     private boolean xmlOut;
> 
>     public Test16(String url, String outFileName,
>                   String errOutFileName, boolean xmlOut)
>     {
>         this.url = url;
>         this.outFileName = outFileName;
>         this.errOutFileName = errOutFileName;
>         this.xmlOut = xmlOut;
>     }
> 
>     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);
>         }
>         catch ( IOException e ) {
>             System.out.println( this.toString() + e.toString() );
>         }
>     }
> 
>     public static void main( String[] args ) {
>         Test16 t1 = new Test16(args[0], args[1], args[2], true);
>         Test16 t2 = new Test16(args[3], args[4], args[5], false);
>         Thread th1 = new Thread(t1);
>         Thread th2 = new Thread(t2);
> 
>         th1.start();
>         th2.start();
>     }
> 
> }
> 
> 
> 
>
Received on Tuesday, 1 May 2001 03:56:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:45 GMT