Sunday, April 30, 2006

JAR and classpath

Arghhhhh, this just cost me about 2hrs...
When running a Java application packaged into my own JAR from the command line with

java -classpath /somepath/library.jar -jar myJar.jar

it just wouln't pick up the library.jar.

You can specify a Class-Path entry in the manifest for your own jar, but thats only used to references jars within your jar, not really external jars.

No matter what I did, I would always get a java.lang.NoClassDefFoundError.

Here's the entry in Sun's Java Forum that finally solved it for me - I quote from the post:

When the -jar option is used, the -classpath or any system classpath is ignored - the only classpath is the one in the manifest of the executable jar file, if specified.

Would it hurt to properly document this ??

Friday, April 28, 2006

OOo filters

New challenge: writing an OpenOffice/StarOffice import filter.
Makes the Thunderbird/XUL tasks a no-brainer.

JSP Tours

I knew that JSPs are very versatile, but this one was new even to me:

Maybe people from the city of Skopje, Macedonia come to Vienna, Austria (where the picture was taken) for JSP classes ?
Shouldn't we then host the next JavaOne ??

Thursday, April 27, 2006

SOA and "Business alignment"

Each and every presentation or textbook on SOA (including mine - presentation, not text book; not yet) starts with how IT has to align with "the business", etc, etc, ... and how there are application silos that seem to be the only thing that keep the business from being an "agile" one.

And everyone just assumes or implies that it is or was the IT department's fault that there currently is a misalignment (given there is one at all).
But weren't the business units those who requested those very silos. Or sometimes even demanded them.
(True, IT departments and the industry at large have their share as well).

But when it comes to SOA we simply assume that the cultural aspects of SOA is something IT has to learn. "The business" (i.e. the sum of the business units, quite a heterogeneous bunch themselves) has to become ready as well. They have to stop demanding their best-of-breed silos.

Once we get over that hurdle, SOA will be easy.

Well, don't quote me on the last one.

Monday, April 10, 2006

Saturday, April 08, 2006

Java for-each vs iterator

Being really happy that in Java 5 the for-each shorthand for loops over collections and the like was introduced, I ran into a stupid pitfall the other day.

With an iterator you can remove an element from the underlying collection using the iterator.remove() method, like this

Iterator it = somelist.iterator();
while (it.hasNext())
{
   MyObject o = it.next();
   // o.dosomething();
   it.remove(); // removes the current object from the list
}


This is no longer visible if you change from iterator to for-each:

for (MyObject o : somelist)
{
   // o.dosomething();
   somelist.remove(o); // removes o from the list
}

Since the iterator is not exposed to your code, the pitfall is to remove the object directly from the collection...

This will cause a ConcurrentModificationException... not a nice thing to do. But actually its quite clear and obvious.

Afterwards...

Friday, April 07, 2006

why bootcamp

why use bootcamp to dual boot a intel mac (which is soooo '80s), when there's parallels, which uses a hypervisor approach... so you should be able to fade in windows when you need it, instead of rebooting...
Wouldn't that be ... like ... um ... better ?

(or rather vmware, and move my PC image right over to the mac... well, I'm allowed to dream...)

book: SOA with webservices

one of the most important books regarding SOA.
Eric Newcomer's Understanding Service-Oriented Architecture (SOA) with Web Services".



A must, when going into SOA...