在jdk1.4中没有提供uuid生成的方法,可以采用开源的jug实现,以下是实例
import org.safehaus.uuid.UUID;
import org.safehaus.uuid.UUIDGenerator;
public class UUIDTest {
/**
* @param args
*/
public static void main(String[] args) {
UUIDGenerator instance = UUIDGenerator.getInstance();
UUID generateTimeBasedUUID = instance.generateTimeBasedUUID();
String s = generateTimeBasedUUID.toString();
System.out.println(s);
UUID r = instance.generateRandomBasedUUID();
System.out.println(r.toString());
}
}