ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Irazabal, Alex" <>
Subject javax and ant
Date Fri, 24 Jan 2003 18:56:36 GMT

Hi. I have a program that compiles standalone but when I use the build file
refuses to import javax.servlet. Any ideas will be GREATLY appriciated. The
problems seems to be that the build is IGNORING my classpath (as seen in the
debug output of the build). My classpath is not included in the debug
output. I have tried to set build.sysclasspath=only and/or ignore.

I have spent way too much time on what should be a no-brainer...

Source code:
 * Created on January 23, 2003, 2:39 PM

 * @author  airazaba
package stock; 

import javax.servlet.*;    

public class stockscrape { 
    /** Creates a new instance of stockscrape */
    public stockscrape() {
     * @param args the command line arguments
    public static void main(String [] args) throws Exception {
        if (args.length!=1){
            System.out.println("Usage: java Stock <symbol>");
        String yahoo = "";
        final int httpd= 80;
        Socket sock = new Socket(yahoo, httpd);
        BufferedWriter out = new BufferedWriter(new
        String cmd = "GET /q?" + "s=" + args[0] + "\n";
        BufferedReader in  = new BufferedReader( new
        String s = null;
        int i,j;
        while ( ( s=in.readLine()) != null) {
            if (s.length() <25) continue;
            if ((i = s.indexOf(args[0].toUpperCase())) < 0) continue;
            s = s.substring(i);
            if ((i = s.indexOf("<b>")) < 0) continue;
            j = s.indexOf("</b>");
            s = s.substring(i+3,j);
            System.out.println(args[0] + " is at "+s);

build file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Written to assume that classpath is rooted in the current directory.
<!-- So this should be OK if you make this script in the root of a
filesystem. -->
<!-- If not, you may prefer to adjust the basedir, or move some directories
around. -->
<!-- The idea is that both Ant and NetBeans have to know what the package
root is -->
<!-- for the classes in your application. -->
<project basedir="." default="all" name="stock">

    <!-- Don't worry if you don't know the Ant syntax completely or need
help on some tasks! -->
    <!-- The standard Ant documentation can be downloaded from AutoUpdate
and -->
    <!-- and then you can access the help in menu Help | Help Sets | Ant
1.5.1 Manual. -->

      <target name="compile">
        <!-- Both srcdir and destdir should be package roots. -->
        <!-- They could be different of course; in that case NetBeans can
also be set -->
         <!-- up to compile to a different filesystem in the same way; see
Compiler Types: -->
        <javac debug="true" deprecation="true" destdir="." srcdir=".">
            <!-- To exclude some files: -->
            <!-- <exclude name="com/foo/"/><exclude
name="com/foo/somepackage/"/> -->
      <target depends="compile" name="jar">
        <!-- To make a standalone app: -->
        <!-- 1. Create a manifest somewhere. -->
        <!-- 2. Put in it two lines: -->
        <!-- Manifest-Version: 1.0 -->
        <!-- Main-Class: -->
        <!-- 3. Pass to <jar>: manifest="" -->
        <jar basedir="." compress="true" jarfile="stocksample.jar">
            <exclude name="**/*.xml"/>
            <exclude name="**/*.java"/>
            <exclude name="**/*.form"/>
            <exclude name=""/>
            <exclude name="stocksample.jar"/>
            <exclude name="apidoc"/>
 <target depends="jar" description="Build everything." name="all">
        <echo message="Application built."/>

    <target depends="compile" description="Try running it."
        <java classname="stockscrape" failonerror="true" fork="true">
           <!-- <classpath> -->
           <!--     <pathelement location="."/> -->
            <!--</classpath> -->
            <!-- Pass some args, perhaps: -->
            <arg value="INTC"/>
            <!-- Will be given as an absolute path: -->
            <!-- arg file="myfile.txt"/> -->

    <target depends="compile" description="Javadoc for my API."
        <mkdir dir="apidoc"/>
        <javadoc destdir="apidoc" packagenames="stockscrape.*">
                <pathelement location="."/>

    <target depends="compile" description="Clean all build products."
            <fileset dir=".">
                <include name="**/*.class"/>
    <delete file="stocksample.jar"/>
        <delete dir="apidoc"/>


errors from build "all":
parsing buildfile C:\jakarta\examples\stock\build.xml with URI =
Setting ro project property: -> stock
Adding reference: stock ->
Project base dir set to: C:\jakarta\examples\stock
 +Target: compile
   +Task: javac
 +Target: jar
   +Task: jar
 +Target: all
   +Task: echo
 +Target: stockscrape
   +Task: java
 +Target: javadoc
   +Task: mkdir
   +Task: javadoc
 +Target: clean
   +Task: delete
   +Task: delete
   +Task: delete
Build sequence for target `all' is [compile, jar, all]
Complete build sequence is [compile, jar, all, stockscrape, javadoc, clean]
fileset: Setup scanner in dir C:\jakarta\examples\stock with patternSet{
includes: [] excludes: [] }
.nbattrs skipped - don't know how to handle it
build.xml skipped - don't know how to handle it
stock.jar skipped - don't know how to handle it
stocksample.jar skipped - don't know how to handle it
stockscrape.class skipped - don't know how to handle it added as C:\jakarta\examples\stock\stockscrape.class is
outdated. skipped - don't know how to handle it
Compiling 1 source file to C:\jakarta\examples\stock
Using modern compiler
Compilation arguments:
'C:\jakarta\examples\stock;C:\Program Files\NetBeans IDE
3.4\lib\patches\openide-compat.jar;C:\Program Files\NetBeans IDE
3.4\lib\core-compiler.jar;C:\Program Files\NetBeans IDE
3.4\lib\core-execution.jar;C:\Program Files\NetBeans IDE
3.4\lib\core-ide.jar;C:\Program Files\NetBeans IDE
3.4\lib\core-ui.jar;C:\Program Files\NetBeans IDE
3.4\lib\core-windows.jar;C:\Program Files\NetBeans IDE
3.4\lib\core.jar;C:\Program Files\NetBeans IDE
3.4\lib\openide.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\locale\ddl_ja.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\crimson.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\ddl.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\idlcompilers.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\logger.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\openorb-1.0.2.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\regexp.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\rmi-ext.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\terminalemulator.jar;C:\Program Files\NetBeans IDE
3.4\lib\ext\xerces.jar;C:\Program Files\NetBeans IDE
The ' characters around the executable and arguments are
not part of the command.
File to be compiled:
stock/ [15] package javax.servlet does not exist
import javax.servlet.*;    
1 error
file:C:/jakarta/examples/stock/build.xml:17: Compile failed; see the
compiler error output for details.
Total time: 0 seconds

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message