find the path of my application installed in registry

前端 未结 1 858
心在旅途
心在旅途 2021-01-27 10:44

Im using the innosetup to install my program java, the installer will generated the key run. I want to get the path of installation

Line of innosetup:

Ro         


        
相关标签:
1条回答
  • 2021-01-27 10:59

    I don't know if there is a built-in registry key for the installed program folder, but you can always create your own. You have the installer script create the registry key during installation, using {app} as the placeholder for the registry value.

    Reading from any arbitrary key in the Windows registry from Java can be done with some trickery, but to keep to standard JDK classes and documented features, it's best to use the standard Preferences interface. Preferences under the system root get placed as keys under HKLM\Software\JavaSoft\Prefs\. Bear in mind there is some strangeness with upper-case letters - each uppercase letter is prefixed with a slash, so keep the name of the key lowercase. e.g. installdir rather than InstallDir.

    In summary: to find the installation directory, add a registry key under Software\Java\Prefs to the installer script and you can use the system root of java.util.Preferences to retrieve the value at runtime.

    0 讨论(0)
提交回复
热议问题