pathelement with javac

Discussion in 'XML' started by hawat.thufir@gmail.com, Jun 1, 2005.

  1. Guest

    I think the compile target is causing the errors...?

    from the terminal:

    [thufir@localhost java]$ cat build.xml
    <project name="tidy" default="package">

    <import file="tidyBuild/properties.xml" />

    <target name="clean">
    <delete dir="${outputDir}" />
    </target>

    <target name="prepare" depends="clean">
    <mkdir dir="${outputDir}" />
    </target>

    <echo message="classpath=${cp}" />

    <target name="compile" depends="prepare">
    <javac
    srcdir ="${sourceDir}"
    destdir ="${outputDir}">
    <classpath>
    <pathelement location="${tidy.path}" />
    </classpath>
    </javac>
    </target>

    <target name="package" depends="compile">
    <jar jarfile="${outputDir}/${mainClass}.jar"
    basedir="${outputDir}"
    >

    <manifest>
    <attribute name="Main-Class"
    value="${pkgPath}${mainClass}"/>
    </manifest>
    </jar>
    </target>

    </project>
    [thufir@localhost java]$ cat tidyBuild/properties.xml
    <project name="properties" basedir=".">
    <property name="outputDir" value="bin/" />
    <property name="sourceDir" value="src/atreides/tidyXhtml/" />
    <property name="mainClass" value="Test16" />
    <property name="pkgPath" value="atreides.tidyXhtml." />
    <property name="user.name" value="thufir" />
    <property name="cp" refid="tidy.path" />

    <path id="tidy.path">
    <pathelement location="lib/Tidy.jar" />
    </path>
    </project>
    [thufir@localhost java]$ cat src/atreides/tidyXhtml/Test16.java
    package atreides.tidyXhtml;

    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 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;
    }//Test16

    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 ) {
    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();
    }//main
    }//Test16
    [thufir@localhost java]$
    [thufir@localhost java]$ ant
    Buildfile: build.xml
    Overriding previous definition of reference to tidy.path
    [echo] classpath=/home/thufir/java/lib/Tidy.jar

    clean:
    [delete] Deleting directory /home/thufir/java/bin

    prepare:
    [mkdir] Created dir: /home/thufir/java/bin

    compile:
    [javac] Compiling 1 source file to /home/thufir/java/bin
    [javac] /home/thufir/java/src/atreides/tidyXhtml/Test16.java:9:
    package
    org.w3c.tidy does not exist
    [javac] import org.w3c.tidy.Tidy;
    [javac] ^
    [javac] /home/thufir/java/src/atreides/tidyXhtml/Test16.java:30:
    cannot find
    symbol
    [javac] symbol : class Tidy
    [javac] location: class atreides.tidyXhtml.Test16
    [javac] Tidy tidy = new Tidy();
    [javac] ^
    [javac] /home/thufir/java/src/atreides/tidyXhtml/Test16.java:30:
    cannot find
    symbol
    [javac] symbol : class Tidy
    [javac] location: class atreides.tidyXhtml.Test16
    [javac] Tidy tidy = new Tidy();
    [javac] ^
    [javac] 3 errors

    BUILD FAILED
    /home/thufir/java/build.xml:18: Compile failed; see the compiler error
    output for
    details.

    Total time: 5 seconds
    [thufir@localhost java]$



    thanks,

    Thufir
    , Jun 1, 2005
    #1
    1. Advertising

  2. Guest

    this seems to fix the problem. here's the new build.xml:

    <project name="tidy" default="package">

    <import file="tidyBuild/properties.xml" />

    <target name="clean">
    <delete dir="${outputDir}" />
    </target>

    <target name="prepare" depends="clean">
    <mkdir dir="${outputDir}" />
    </target>

    <echo message="classpath=${cp}" />

    <target name="compile" depends="prepare">
    <javac
    srcdir ="${sourceDir}"
    destdir ="${outputDir}">
    <classpath>
    <path refid="tidy.path" />
    </classpath>
    </javac>
    </target>

    <target name="package" depends="compile">
    <jar jarfile="${outputDir}/${mainClass}.jar"
    basedir="${outputDir}" >
    <manifest>
    <attribute name="Main-Class"
    value="${pkgPath}${mainClass}"/>
    </manifest>
    </jar>
    </target>

    </project>


    is ant offtopic here, or something?


    -Thufir
    , Jun 2, 2005
    #2
    1. Advertising

  3. HALLES Guest

    Hello !
    It llok like a java class to make a XML files, using read write append
    ?

    Do i mistake?

    Can java class be used in client side ?
    To automatize data input and file writing ?
    I can't invest on a server and its softs.

    I have a structured work to save on local drive, linear files like TXT
    are of no use.
    Actually all the work is or in my mind or on thousands of papers with
    cross references.
    It is no dictionary like, linear job to do.

    Dynamic files can help, because while already structured the info put
    on the files can be used to build a more structured file or more
    structured files.

    It become complex, to explain, it is only a work of linguistic, and it
    can be done by a computer.

    Any info back, welcome.

    Regards.
    HALLES.
    HALLES, Jun 3, 2005
    #3
  4. Guest

    HALLES wrote:
    > Hello !
    > It llok like a java class to make a XML files, using read write append
    > ?
    >
    > Do i mistake?


    I don't believe so :)

    > Can java class be used in client side ?


    sure, send this class a URL and it will tidy-ize it. that is, take old
    fashioned html and convert it to XHTML. my pet project is to work on
    some html files which exist on my hard drive, along the lines of your
    plans.

    > To automatize data input and file writing ?
    > I can't invest on a server and its softs.
    >
    > I have a structured work to save on local drive, linear files like TXT
    > are of no use.
    > Actually all the work is or in my mind or on thousands of papers with
    > cross references.
    > It is no dictionary like, linear job to do.
    >
    > Dynamic files can help, because while already structured the info put
    > on the files can be used to build a more structured file or more
    > structured files.
    >
    > It become complex, to explain, it is only a work of linguistic, and it
    > can be done by a computer.
    >
    > Any info back, welcome.
    >
    > Regards.
    > HALLES.



    check out the tidy and jtidy projects on <http://www.sourceforge.net/>.


    -Thufir
    , Jun 3, 2005
    #4
  5. HALLES Guest

    Hello.

    You speak of URL, i can't see how to declare an drive as an URL.

    I have stopped programing 10 years ago, i used TP 7, nice but 16 bit
    limited.

    I will try jtidy.

    Regards.

    HALLES ;o)
    HALLES, Jun 4, 2005
    #5
  6. Guest

    HALLES wrote:
    > Hello.
    >
    > You speak of URL, i can't see how to declare an drive as an URL.


    pardon, it doesn't have to be a URL. when you unzip the files from
    sourceforge there will be a file names Tidy.jar, this is what you're
    after. when you feed a html file through Tidy.jar it will convert it
    to xhtml, like magic. the java code I have, Test16, that happens to
    take a url as input, however, Tidy.jar will take any html file as input
    as far as I know. To my knowledge it should be trivial to feed it a
    file, foo.html, versus a URL.

    > I have stopped programing 10 years ago, i used TP 7, nice but 16 bit
    > limited.


    java is object oriented, just as a heads up.

    > I will try jtidy.
    >
    > Regards.
    >
    > HALLES ;o)


    I've sent you an e-mail, since this is getting off topic for xml.

    -Thufir
    , Jun 4, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. xarax
    Replies:
    1
    Views:
    1,453
    Andy Flowers
    Jul 2, 2003
  2. Jon Skeet
    Replies:
    5
    Views:
    543
    xarax
    Jul 4, 2003
  3. Richard Ivarson
    Replies:
    1
    Views:
    498
    Dario
    Jul 14, 2003
  4. z3
    Replies:
    0
    Views:
    478
  5. Ronald Fischer

    Ant javac : How to print classpath?

    Ronald Fischer, Sep 18, 2003, in forum: Java
    Replies:
    1
    Views:
    17,545
    Wayne Berke
    Sep 19, 2003
Loading...

Share This Page