I was setting out to write a piece of code today in Eclipse, and I started out like so:
public class MyClass { System.currentTimeMillis(); }
Try this way:
public class MyClass { static { System.currentTimeMillis(); } }
If you call System.currentTimeMillis() inside a static statement it works. The static block will be called when the class "MyClass" is loaded by the class loader.