Running an external program is much slower than calling a JNI function. But, if you are only doing it once (probably true in your case), running an external program may be fast
enough.
Passing complicated data between and external program and your Java code can be more difficult than doing it in JNI. However, in your case, the data is unlikely to be complicated.
Once you have added your first bit of JNI to your program, every subsequent bit of JNI is much easier than the first; you'll already have sorted out how to build the library, how to load it, how to deploy it in your installations etc. Therefore, think carefully. If getting the hard-drive serial number is the only thing you need to do outside pure Java, it's probably not worth JNI. If you are likely to end up needing lots of similar facilities,
you should probably go for JNI.