I don't use Visual Basic, etc. so there may be a function built in, however if not (and assuming you want your code to work pre-vista) then I believe you must make changes directly to the registry.
I found the following code snippet...
@="Executable Jar File"
@="C:\\Program Files\\JavaSoft\\JRE\\1.3.1\\bin\\javaw.exe -jar %1"
If you place this is a .reg file and execute it, necessary registry changes should be made.
Personally, I would use API functions such as RegOpenKeyEx but this may be more complicated.