You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by teknokrat <te...@yahoo.com> on 2008/11/19 18:21:55 UTC

classpath issues in custom task

I have a custom ant task with the following cast

JavacTask jTask = (JavacTask) task;

where task is a CompilationTask generated by JavaCompiler and JavacTask 
is an instance of com.sun.source.util.JavacTask from tools.jar

When I am in eclipse everyhting works properly
The following code
             					 
System.out.println(task.getClass().getClassLoader().getClass());	 
System.out.println(JavacTask.class.getClassLoader().getClass());
JavacTask jTask = (JavacTask) task;


Outputs

class sun.misc.Launcher$AppClassLoader
class sun.misc.Launcher$AppClassLoader

However, when i run ant outside of eclipse ( ant 1.7 on windows XP and 
java 6) I get

class java.net.FactoryURLClassLoader
class java.net.URLClassLoader

which clearly throws a ClassCastException

Any ideas on how to solve this or why its even happening??

cheers




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