By far the best solution would be to make do without reading the registry. Why do you need to get the path where MS SQL Server is installed?
Anyway: you've probably run into the remapping of directories and registry keys which some exceptionally bright mind introduced into 64-bit versions of Windows. When a 32-bit application running on 64-bit Windows tries to access certain files or registry keys, the operating system silently redirects the request into other directories/registry keys. The net result is that 32bit and 64bit application sees different files/registry values when using the same name. (See how useful is that? I don't.)
While a 32-bit application can probably circumvent these redirections somehow, I'd suggest to simply run your application using 64-bit version of the JVM. This way your application won't be subject to these redirections. If this solution is not acceptable to you, you'll need to google up something like WOW64 redirections. I'm really no expert on this and I'm battling this insanity myself from time to time.
subject: Win32Exception: Failed to open 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_5