ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From THUFIR HAWAT <hawat.thu...@gmail.com>
Subject import foo.jar
Date Mon, 14 Mar 2005 10:51:08 GMT
The data:

D:\>
D:\>
D:\>type build.xml
<project name="XHTML" default="package">

        <property name="outputDir" value="java\classes\" />
        <property name="sourceDir" value="java\src\atreides\xhtml\" />
        <property name="mainClass" value="HelloWorldSwing" />
        <property name="pkgPath" value="atreides.xhtml." />

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

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

        <target name="compile" depends="prepare">
                <javac srcdir="${sourceDir}" destdir="${outputDir}"  />
        </target>

        <target name="manifest" depends="compile">
                <manifest file="${outputDir}/MANIFEST.MF">
                        <attribute name="Main-Class" 
value="${pkgPath}${mainClass}" />
                </manifest>
        </target>

        <target name="package" depends="manifest">
                <jar jarfile="${outputDir}/${mainClass}.jar"
                basedir="${outputDir}"
                manifest="${outputDir}/MANIFEST.MF" />
        </target>
</project>

D:\>type java\src\atreides\xhtml\HelloWorldSwing.java
package atreides.xhtml;
import javax.swing.*;
//import org.w3c.tidy.Tidy;

public class HelloWorldSwing {
    /**
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
     */
    private static void createAndShowGUI() {
        //Make sure we have nice window decorations.
        JFrame.setDefaultLookAndFeelDecorated(true);

        //Create and set up the window.
        JFrame frame = new JFrame("HelloWorldSwing");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //Add the ubiquitous "Hello World" label.
        JLabel label = new JLabel("Hello World");
        frame.getContentPane().add(label);

        //Display the window.
        frame.pack();
        frame.setVisible(true);
    }

    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}

D:\>dir java\src\org\w3c\tidy
 Volume in drive D has no label.
 Volume Serial Number is 1CBF-03ED

 Directory of D:\java\src\org\w3c\tidy

03/14/2005  10:02a      <DIR>          .
03/14/2005  10:02a      <DIR>          ..
10/22/2000  12:40p             162,822 Tidy.jar
               1 File(s)        162,822 bytes
               2 Dir(s)   3,580,088,320 bytes free

D:\>


the statement which imports Tidy.jar is commented out because it just creates 
errors.  The syntax from the JTidy website is "import org.w3c.tidy.Tidy;" but 
since it's a .jar file "import org.w3c.tidy.Tidy.jar;" makes more sense...?

the error message, if the comment is removed:
D:\>ant
Buildfile: build.xml

clean:
   [delete] Deleting directory D:\java\classes

prepare:
    [mkdir] Created dir: D:\java\classes

compile:
    [javac] Compiling 1 source file to D:\java\classes
    [javac] D:\java\src\atreides\xhtml\HelloWorldSwing.java:3: package 
org.w3c.tidy does not exist
    [javac] import org.w3c.tidy.Tidy;
    [javac]                     ^
    [javac] 1 error

BUILD FAILED
D:\build.xml:17: Compile failed; see the compiler error output for details.

Total time: 4 seconds
D:\>



thanks,

Thufir

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


Mime
View raw message