Archive for the ‘Java’ Category

Did you ever fought a HeadlessException?

Saturday, December 15th, 2007

Once I wrote some JUnit tests for a framework which referenced GUI components in the model. No worries on my development machine - but as I moved those tests to the test server I’ve got that bloody HeadlessException. At this very moment I felt a bit headless too.
(more…)

Locked jar file under Windows

Friday, December 14th, 2007

During the service hot swap mechanism development of NetServe I run into the problem that jar files getting locked by the JRE under Windows.

After some research I found a simple solution for this problem (maybe it’s a performance issue). Before you instanciate a custom classloader you have to disable caching on the URL.

URL[] urls = new URL[1];
urls[0] = new URL(“/path/to/my.jar”);
url.openConnection().setDefaultUseCaches(false);
ClassLoader cl = new URLClassLoader(urls);

After that, your jar’s won’t get locked.