Why is the rootLoader null?

View: New views
2 Messages — Rating Filter:   Alert me  

Why is the rootLoader null?

by geossscripting :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When I run a script from Eclipse, the following line :

def rootLoader = this.class.getClassLoader().getRootLoader()


returns null. If I run the script from the command line, it's not null. I'm using the rootLoader to add jars at runtime.

What could be the reason for this behaviour?

--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Re: Why is the rootLoader null?

by Jochen Theodorou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Lex Williams schrieb:
> When I run a script from Eclipse, the following line :
>
> def rootLoader = this.class.getClassLoader().getRootLoader()
>
>
> returns null. If I run the script from the command line, it's not null.
> I'm using the rootLoader to add jars at runtime.

For one, you should read the documentation for this method. It may
return null, if there is no RootLoader as parent to
this.class.classLoader. If for example your script is started using the
java command, then there will usually be no RootLoader, since it is
infrastructure the java command does not set up.


bye blackdrag

--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email