Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get MS-Windows Installed Applications from Java

Tags:

java

Is it possible to get a list of installed applications (like the list from the un-install programs) from a windows vista computer with java?

like image 596
Rafiq Flucas Avatar asked Sep 06 '25 03:09

Rafiq Flucas


1 Answers

Not a Solution but a workaround!!

Getting windows native information using java SDK is not possible without support of external APIs. Instead of using external APIs (which is mostly LGPL licensed and not completely open), we can use the shell commands to get the same.

For getting the installed softwares list, use ProcessBuilder or Runtime.exec to run one of the following PowerShell commands:

  1. Get-WmiObject -class Win32_Product | Select-Object -Property Name - This is bit slower! It uses Win32_Product class.
  2. Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate - This is faster and can give additional details. This uses PS registry provider.

You can stream the output of these and process it.

This is just a workaround and it is as per my analysis. As java is completely platform independent, fetching native information becomes difficult and the use of platform native tools (like command shell,, power shell etc.,) is a must.

like image 146
Arun Pratap Avatar answered Sep 07 '25 20:09

Arun Pratap