I've created a library for generating UUIDs with Java, based on RFC 4122. If you're using Java 1.6, this will use a hardware MAC address to generate a UUID as specified in the RFC. If not, it uses a randomly generated number for the node.
Note that while Java 1.5 added a UUID class, this library uses its own UUID class.
Update: Version 0.9.1 no longer requires Java 1.6 to compile and now runs under Java 1.5. You may also now choose whether or not to use your MAC address as the node value using the built-in generator under Java 1.6.