ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Mark Bram <relaxed...@optusnet.com.au>
Subject Problem using org.apache.tools.ant.taskdefs.Java
Date Wed, 30 Jun 2004 05:33:37 GMT
Hi All!

I am trying to use org.apache.tools.ant.taskdefs.Java to run a Java app 
 from within my custom task. Here is the code I am using. The app I wish to 
run is called "common.guitools.Test" and it resides within
F:\java\jiniHelloWorld\lib\common.jar. "F:\java\jiniHelloWorld\" is 
reported as user.dir.


       // Run common.guitools.Test as a Java task
       Java testTask = new Java();
       testTask.setSpawn (true);
       testTask.setFork(true);
       Path classpath = testTask.createClasspath();
       FileSet fileSet = new FileSet();
       fileSet.setFile(new File (System.getProperty("user.dir") 
+ "\\lib\\common.jar"));
       fileSet.createInclude().setName("*.jar");
       classpath.addFileset(fileSet);
       testTask.setClassname("common.guitools.Test");
       testTask.createArg().setValue("one");
       testTask.createArg().setValue("two");
       testTask.createArg().setValue("three");
       testTask.execute();

When I run this I get the error below. Any hints as to how I am using 
org.apache.tools.ant.taskdefs.Java incorrectly would be most welcome!

Rob
:)

$ ant -f test.xml
Buildfile: test.xml

main:
      [echo] At start of Task

BUILD FAILED
java.lang.NullPointerException
         at 
org.apache.tools.ant.types.AbstractFileSet.setupDirectoryScanner(AbstractFileSet.java:382)
         at 
org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:358)
         at org.apache.tools.ant.types.Path.list(Path.java:324)
         at org.apache.tools.ant.types.Path.list(Path.java:312)
         at org.apache.tools.ant.types.Path.addExisting(Path.java:245)
         at org.apache.tools.ant.types.Path.addExisting(Path.java:234)
         at 
org.apache.tools.ant.types.Path.concatSystemClasspath(Path.java:547)
         at 
org.apache.tools.ant.types.CommandlineJava.haveClasspath(CommandlineJava.java:571)
         at 
org.apache.tools.ant.types.CommandlineJava.addCommandsToList(CommandlineJava.java:368)
         at 
org.apache.tools.ant.types.CommandlineJava.getCommandline(CommandlineJava.java:348)
         at 
org.apache.tools.ant.types.CommandlineJava.describeCommand(CommandlineJava.java:416)
         at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:129)
         at org.apache.tools.ant.taskdefs.Java.execute(Java.java:77)
         at common.ant.MyVeryOwnTask.execute(Unknown Source)
         at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
         at org.apache.tools.ant.Task.perform(Task.java:364)
         at org.apache.tools.ant.Target.execute(Target.java:301)
         at org.apache.tools.ant.Target.performTasks(Target.java:328)
         at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
         at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
         at org.apache.tools.ant.Main.runBuild(Main.java:632)
         at org.apache.tools.ant.Main.startAnt(Main.java:183)
         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

Total time: 8 seconds
java.lang.NullPointerException
         at 
org.apache.tools.ant.types.AbstractFileSet.setupDirectoryScanner(AbstractFileSet.java:382)
         at 
org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:358)
         at org.apache.tools.ant.types.Path.list(Path.java:324)
         at org.apache.tools.ant.types.Path.list(Path.java:312)
         at org.apache.tools.ant.types.Path.addExisting(Path.java:245)
         at org.apache.tools.ant.types.Path.addExisting(Path.java:234)
         at 
org.apache.tools.ant.types.Path.concatSystemClasspath(Path.java:547)
         at 
org.apache.tools.ant.types.CommandlineJava.haveClasspath(CommandlineJava.java:571)
         at 
org.apache.tools.ant.types.CommandlineJava.addCommandsToList(CommandlineJava.java:368)
         at 
org.apache.tools.ant.types.CommandlineJava.getCommandline(CommandlineJava.java:348)
         at 
org.apache.tools.ant.types.CommandlineJava.describeCommand(CommandlineJava.java:416)
         at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:129)
         at org.apache.tools.ant.taskdefs.Java.execute(Java.java:77)
         at common.ant.MyVeryOwnTask.execute(Unknown Source)
         at 
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
         at org.apache.tools.ant.Task.perform(Task.java:364)
         at org.apache.tools.ant.Target.execute(Target.java:301)
         at org.apache.tools.ant.Target.performTasks(Target.java:328)
         at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
         at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
         at org.apache.tools.ant.Main.runBuild(Main.java:632)
         at org.apache.tools.ant.Main.startAnt(Main.java:183)
         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

/cygdrive/f/java/jiniHelloWorld
$



-- 
Robert Mark Bram
B.Comp.(Systems Development/Business Systems)
B.Net.Comp.(Hons)
Doctor of Philosophy Student

School of Network Computing
Faculty of Information Technology
Monash University
Peninsula Campus
McMahons Rd
Frankston, VIC 3199
AUSTRALIA

Phone:  61 3 9904 4394
Facsimile:  61 3 9904 4124
Email: robert.mark.bram@infotech.monash.edu.au


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


Mime
View raw message