ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tek1 <t...@pobox.com>
Subject Re: custom ant task can't find classpath
Date Tue, 09 Apr 2002 13:02:53 GMT
looks like:

ExecuteJava execJava = new ExecuteJava();
execJava.setClasspath( helperJarFile );

did the trick.  thank you.

i missed the "setClasspath()" method.  perhaps it's just me, but that 
method seems better suited for the CommandlineJava class...

anyway, the ant task works (at the command line), but i'm now getting the 
following when i try to run the task from within netbeans:


org.netbeans.core.execution.ExitSecurityException
         at 
org.netbeans.core.execution.TopSecurityManager.checkExitImpl(TopSecurityManager.java:95)
         at 
org.netbeans.core.execution.TopSecurityManager$PrivilegedCheck.run(TopSecurityManager.java:458)
         at java.security.AccessController.doPrivileged(Native Method)
         at 
org.netbeans.core.execution.TopSecurityManager$PrivilegedCheck.check(TopSecurityManager.java:483)
         at 
org.netbeans.core.execution.TopSecurityManager$PrivilegedCheck.checkExit(TopSecurityManager.java:471)
         at 
org.netbeans.core.execution.TopSecurityManager.checkExit(TopSecurityManager.java:78)
         at java.lang.Runtime.exit(Runtime.java:91)
         at java.lang.System.exit(System.java:701)
         at MyJavaClass.main(Unknown Source)
         at java.lang.reflect.Method.invoke(Native Method)
         at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:124)
         at com.vizionari.ant.obfuscator.RetroGuardTask.execCmdLine(Unknown Source)
         at com.vizionari.ant.obfuscator.RetroGuardTask.execute(Unknown Source)
         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:104)
         at org.apache.tools.ant.Task.perform(Task.java:217)
         at org.apache.tools.ant.Target.execute(Target.java:184)
         at org.apache.tools.ant.Target.performTasks(Target.java:202)
         at org.apache.tools.ant.Project.executeTarget(Project.java:601)
         at org.apache.tools.ant.Project.executeTargets(Project.java:560)
         at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:277)
         at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:118)


i think that this is more of a netbeans issue than ant, so no replies 
necessary, but if you also use ant with netbeans and have experienced this, 
i'd appreciate any hints.

does it mean that the java .class is trying to call something like 
System.exit(0) and netbeans won't permit it b/c if it does, netbeans also 
will exit?  for those familiar with ant, does this mean that i have to 
"fork the vm" when i execute my java .class?

thank you.





At 12:59 02/04/09 +0900, you wrote:
>At 09:40 02/04/09 +1000, you wrote:
>
>>Hi,
>>
>>It's kinda hard to figure out what's going wrong without seeing your code.
>>Using ExecuteJava is pretty straight-forward, though - you should be doing
>>something like this in your task:
>>
>>public void execute()
>>{
>>     Path classpath = new Path( getProject() );
>>     classpath.setLocation( helperJarFile );
>
>i tried:
>
>Commandline cmdline = new Commandline();
>
>Path p = cmdline.createClasspath( getProject() );
>p.setLocation( helperJarFile );
>
>  this, but when i print out the parameters that are being used for the 
> command line, the classpath appears to be null.  as a result, i'm setting 
> the classpath by doing the following:
>
>cmdline.createArgument().setValue("-classpath");
>cmdline.createArgument().setValue(absolutePathToJarFile);
>
>everything else is the same.  i will try your suggestion for setting the 
>classpath.
>
>thank you.
>
>
>
>>     Commandline cmdline = new Commandline();
>>     cmdline.setExecutable( "Help" );
>>     cmdline.createArgument().setValue( param1 );
>>
>>     ExecuteJava exe = new ExecuteJava();
>>     exe.setCommandline( cmdline );
>>     exe.setClasspath( classpath );
>>
>>     exe.execute( getProject() );
>>}
>
>
>--
>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