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?
package Vishal;
import com.sun.jna.platform.win32.Advapi32Util;
import static com.sun.jna.platform.win32.WinReg.HKEY_LOCAL_MACHINE;
import java.util.ArrayList;
import java.util.TreeMap;
public class GenerateInstalledApplicationList
{
ArrayList getlist()
{
ArrayList arr = new ArrayList();
String [] keys = Advapi32Util.registryGetKeys(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall");
String temp;
for (String key : keys)
{
temp = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall" + "\\" +key;
TreeMap tr = Advapi32Util.registryGetValues(HKEY_LOCAL_MACHINE,temp);
if(tr.isEmpty())
{
if(!key.contains("Update"))//all the instances of update are not actually installed applications
{
arr.add(key);
}
}
else
{
if(tr.containsKey("DisplayName"))
{
String str = (String) tr.get("DisplayName");
if(!str.contains("Update"))
{
arr.add(str);
}
}
}
}
return arr;
}}
Just Copy and paste this code it will return all the installed applications only thing you will need is the jna api.