ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Irazabal, Alex" <Alex.Iraza...@aig.com>
Subject RE: javax and ant - RESOLVED!
Date Mon, 27 Jan 2003 15:10:33 GMT
Thanks for all of you who gave me ideas. The problem lies with the fact that
other jars in the path HAD JAVAX entries (swing, http, etc) EXCEPT servlet.
Apparently once it find one entry with JAVAX it stops searching (or ignores)
other JAVAX jars!!! So I removed the other jars from the path and bingo!

Thanks for all the comments!
Alex

-----Original Message-----
From: David Knox [mailto:david.knox@iona.com]
Sent: Friday, January 24, 2003 8:08 PM
To: 'Ant Users List'
Subject: RE: javax and ant


javax.servlet is in j2ee.jar in the j2sdkee1.3.1.  Looking at your debug
output I don't see anything that would contain javax.servlet. Just as an
experiment could you add a <classpath> element pointing to the j2ee.jar
to the <javac> task in the compile <target> and see if the behavior is
any different. I imagine that j2ee.jar is in your environment because
your non-Ant compile appears to work.

HTH,
-- knoxy

> -----Original Message-----
> From: Irazabal, Alex [mailto:Alex.Irazabal@aig.com]
> Sent: Friday, January 24, 2003 12:29 PM
> To: 'Ant Users List'
> Subject: RE: javax and ant
> 
> no.
> 
> -----Original Message-----
> From: Ciramella, Edward [mailto:ECiramella@emptoris.com]
> Sent: Friday, January 24, 2003 2:27 PM
> To: 'Ant Users List'
> Subject: RE: javax and ant
> 
> 
> Isn't javax.servlet in the j2ee.jar?
> 
> -----Original Message-----
> From: Irazabal, Alex [mailto:Alex.Irazabal@aig.com]
> Sent: Friday, January 24, 2003 2:13 PM
> To: 'Ant Users List'
> Subject: RE: javax and ant
> 
> 
> David here is what I got after I put in your changes...
> Alex
> 
> parsing buildfile C:\jakarta\examples\stock\build.xml with URI =
> file:C:/jakarta/examples/stock/build.xml
> Setting ro project property: ant.project.name -> stock
> Adding reference: stock -> org.apache.tools.ant.Project@f7e0d1
> Project base dir set to: C:\jakarta\examples\stock
>    +DataType: path
> Adding reference: compile.classpath ->
> Property ${lib.dir} has not been set
>  +Target: compile
>    +Task: javac
>  +Target: init
>    +Task: mkdir
>  +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 [init, compile, jar, all]
> Complete build sequence is [init, compile, jar, all, stockscrape,
javadoc,
> clean]
> init:
> compile:
> 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
> stockscrape.java added as
> C:\jakarta\examples\stock\classes\stockscrape.class doesn't exist.
> stockscrape.mf skipped - don't know how to handle it
> Compiling 1 source file to C:\jakarta\examples\stock\classes
> Using modern compiler
> Compilation arguments:
> '-d'
> 'C:\jakarta\examples\stock\classes'
> '-classpath'
> 'C:\jakarta\examples\stock\classes;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
> 3.4\lib\ext\xml-
> apis.jar;C:\j2sdk1.4.1\lib\dt.jar;C:\j2sdk1.4.1\lib\tools.ja
> r'
> '-sourcepath'
> 'C:\jakarta\examples\stock'
> '-g:none'
> The ' characters around the executable and arguments are
> not part of the command.
> File to be compiled:
>     C:\jakarta\examples\stock\stockscrape.java
> stock/stockscrape.java [15] package javax.servlet does not exist
> import javax.servlet.*;
> ^
> 1 error
> file:C:/jakarta/examples/stock/build.xml:21: Compile failed; see the
> compiler error output for details.
>         at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:842)
>         at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
>         at org.apache.tools.ant.Task.perform(Task.java:319)
>         at org.apache.tools.ant.Target.execute(Target.java:309)
>         at org.apache.tools.ant.Target.performTasks(Target.java:336)
>         at
org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>         at
org.apache.tools.ant.Project.executeTargets(Project.java:1250)
>         at
>
org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:2
94
> )
>         at
>
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:119)
> BUILD FAILED
> Total time: 0 seconds
> 
> -----Original Message-----
> From: David McTavish [mailto:dmctavish@SANDVINE.com]
> Sent: Friday, January 24, 2003 2:01 PM
> To: 'Ant Users List'
> Subject: RE: javax and ant
> 
> 
> try creating a classpath element in your build file and include the
jar
> file
> that way for starters.
> 
>     <path id="compile.classpath">
>         <path location="${lib.dir}/servlet.jar"/>
>     </path>
> 
>         <target name="compile">
>             <javac srcdir="src"
>                    destdir="classes"
>                    classpathref="compile.classpath"
>                    includeAntRuntime="false"
>                    includeJavaRuntime="false"/>
>         </target>
> 
> 
> I find we get more problems when compiling and using the classpath
that
> Ant
> inherits than its worth. (ie: we were having a ton of problems with
> inconsistencies with the XML library that Ant was using and a newer
> version
> that we were trying to compile with. Code wouldn't compile because the
> class-loader was finding the wrong library).
> 
> d.
> 
> 
> -----Original Message-----
> From: Irazabal, Alex [mailto:Alex.Irazabal@aig.com]
> Sent: Friday, January 24, 2003 1:57 PM
> To: 'ant-user@jakarta.apache.org'
> Subject: javax and ant
> 
> 
> 
> 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:
> /*
>  * stockscrape.java
>  *
>  * Created on January 23, 2003, 2:39 PM
>  */
> 
> /**
>  *
>  * @author  airazaba
>  */
> package stock;
> 
> import java.io.*;
> import java.net.*;
> 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>");
>             System.exit(0);
>         }
>         String yahoo = "finance.yahoo.com";
>         final int httpd= 80;
>         Socket sock = new Socket(yahoo, httpd);
> 
>         BufferedWriter out = new BufferedWriter(new
> OutputStreamWriter(sock.getOutputStream()));
> 
>         String cmd = "GET /q?" + "s=" + args[0] + "\n";
>         out.write(cmd);
>         out.flush();
> 
>         BufferedReader in  = new BufferedReader( new
> InputStreamReader(sock.getInputStream()));
>         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);
>             break;
>         }
>     }
> 
> }
> 
> 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/SomeFile.java"/><exclude
> name="com/foo/somepackage/"/> -->
>         </javac>
>    </target>
> 
>       <target depends="compile" name="jar">
>         <!-- To make a standalone app: -->
>         <!-- 1. Create a myapp.mf manifest somewhere. -->
>         <!-- 2. Put in it two lines: -->
>         <!-- Manifest-Version: 1.0 -->
>         <!-- Main-Class: com.foo.Main -->
>         <!-- 3. Pass to <jar>: manifest="myapp.mf" -->
>         <jar basedir="." compress="true" jarfile="stocksample.jar">
>             <exclude name="**/*.xml"/>
>             <exclude name="**/*.java"/>
>             <exclude name="**/*.form"/>
>             <exclude name="stockscrape.mf"/>
>             <exclude name="stocksample.jar"/>
>             <exclude name="apidoc"/>
>         </jar>
>     </target>
>  <target depends="jar" description="Build everything." name="all">
>         <echo message="Application built."/>
>     </target>
> 
> 
>     <target depends="compile" description="Try running it."
> name="stockscrape">
>         <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"/> -->
>         </java>
>     </target>
> 
>     <target depends="compile" description="Javadoc for my API."
> name="javadoc">
>         <mkdir dir="apidoc"/>
>         <javadoc destdir="apidoc" packagenames="stockscrape.*">
>             <sourcepath>
>                 <pathelement location="."/>
>             </sourcepath>
>         </javadoc>
>     </target>
> 
>     <target depends="compile" description="Clean all build products."
> name="clean">
>         <delete>
>             <fileset dir=".">
>                 <include name="**/*.class"/>
>             </fileset>
>         </delete>
>     <delete file="stocksample.jar"/>
>         <delete dir="apidoc"/>
>     </target>
> 
> </project>
> 
> errors from build "all":
> parsing buildfile C:\jakarta\examples\stock\build.xml with URI =
> file:C:/jakarta/examples/stock/build.xml
> Setting ro project property: ant.project.name -> stock
> Adding reference: stock -> org.apache.tools.ant.Project@16729a9
> 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]
> compile:
> 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
> stockscrape.java added as C:\jakarta\examples\stock\stockscrape.class
is
> outdated.
> stockscrape.mf skipped - don't know how to handle it
> Compiling 1 source file to C:\jakarta\examples\stock
> Using modern compiler
> Compilation arguments:
> '-deprecation'
> '-d'
> 'C:\jakarta\examples\stock'
> '-classpath'
> '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
> 3.4\lib\ext\xml-
> apis.jar;C:\j2sdk1.4.1\lib\dt.jar;C:\j2sdk1.4.1\lib\tools.ja
> r'
> '-sourcepath'
> 'C:\jakarta\examples\stock'
> '-g'
> The ' characters around the executable and arguments are
> not part of the command.
> File to be compiled:
>     C:\jakarta\examples\stock\stockscrape.java
> stock/stockscrape.java [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.
>         at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:842)
>         at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
>         at org.apache.tools.ant.Task.perform(Task.java:319)
>         at org.apache.tools.ant.Target.execute(Target.java:309)
>         at org.apache.tools.ant.Target.performTasks(Target.java:336)
>         at
org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>         at
org.apache.tools.ant.Project.executeTargets(Project.java:1250)
>         at
>
org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:2
94
> )
>         at
>
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:119)
> BUILD FAILED
> Total time: 0 seconds
> 
> --
> To unsubscribe, e-mail:
<mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:
<mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:
<mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:
<mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:ant-user-help@jakarta.apache.org>


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

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


Mime
View raw message