使用 Java 在 Windows 上检查已安装的程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6860968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Check for installed program on windows using Java?
提问by Asghar
Possible Duplicate:
How to check if a program is installed on system
可能的重复:
如何检查系统上是否安装了程序
I need to check whether a specific program is installed or not on my system. For example, my program needs to check whether FireFoxis installed in my system. If a program is installed , then i want to find the installation directoryof that specific program.
我需要检查我的系统上是否安装了特定的程序。例如,我的程序需要检查我的系统中是否安装了FireFox。如果安装了程序,那么我想找到该特定程序的安装目录。
I found thisbut this is not in java. I read thisbut still i am unable to solve this
回答by santosh-patil
Every software (say Firefox) creates it's entry under the path
每个软件(比如 Firefox)都会在路径下创建它的条目
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
Firefox also creates it under the same path. In my machine
Firefox 也在同一路径下创建它。在我的机器上
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Mozilla Firefox5.0.1(x86 en-US)
is path for that.
是路径。
Existance of this path confirms that firefox is installed on machine. For the installation directory, read the value of key named 'InstallLocation' under above mentioned path for Firefox.
此路径的存在确认机器上安装了 Firefox。对于安装目录,读取 Firefox 上面提到的路径下名为“InstallLocation”的键的值。