List of Installed Programs on Windows from java

I was recently in need of a way to pick up the list of installed software on a windows computer from Java. It was shrouded in a veil a mystery. There did not seem to be a functional call that I could make, which makes sense since Java is cross-platform and there is not universal way to pick up all the installed packages on an OS.

In fact, picking up all the installed packages on Windows seems be a bit cryptic. There are API calls you can make and I considered JNI. I suspect this might be a superior solution, but I haven’t tried it and I read that it may be slow.

After much research, I came across ListPrograms. My initial thought was to link to it using JNI. However, it seemed simple enough to warrant a rewrite in Java if I could access the registry somehow.

This is where JNA and the Advapi32Util class came in handy.

It didn’t take me long to put together a quick replica of behaviour. I skipped out the part about user installed programs because it isn’t relevant for me (yet).

I also missed out issues which will be around when running it as part of a 32bit VM within a 64bit OS.

You can find JavaListApps at GitHub

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.