Static initializers are not executed

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

Static initializers are not executed

by Varghese C V :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Static initializer blocks are not executed when a class is loaded.

SimpleCompiler compiler = new SimpleCompiler();
compiler.cook(new StringReader("public class
Test{static{System.out.println(\"Hi\");}}"));
Class testClass = compiler.getClassLoader().loadClass("Test");

There are no errors but no console output either.
Is there something I can do to make this work?

regards
Varghese C V


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

    http://xircles.codehaus.org/manage_email


Re: Static initializers are not executed

by Arno Unkrig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I created a ticket for this one. Please check

http://jira.codehaus.org/browse/JANINO-102


CU

Arno

Varghese C V schrieb:

> Static initializer blocks are not executed when a class is loaded.
>
> SimpleCompiler compiler = new SimpleCompiler();
> compiler.cook(new StringReader("public class
> Test{static{System.out.println(\"Hi\");}}"));
> Class testClass = compiler.getClassLoader().loadClass("Test");
>
> There are no errors but no console output either.
> Is there something I can do to make this work?
>
> regards
> Varghese C V
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


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

    http://xircles.codehaus.org/manage_email