We help IT Professionals succeed at work.

Generate a GUID/UUID from Java?

GregL
GregL asked
on
2,882 Views
Last Modified: 2012-05-04
Can anyone show me how to generate a GUID or UUID from Java code.  I am using JDK 1.2b4 and JSDK 2.0.

Thanks
Comment
Watch Question

Commented:
There are WINDOWS API functions for this purpose, for example CoCreateGUID();
Use JNI to declare a native methods in the class and then 'javah.exe' to generate the stubs. Then implement the calls with MSVC++ for example, and compile as a shared .dll.

Commented:
From Java, you cannot do this directly :-)
Cheers,
  Nik

Author

Commented:
I will reopen to see if there is an all java way.  If I don't get another answer diakov will get the points.
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks to all...
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.