Ask Your Question

Approach update Java Plugin on Windows

asked 2015-12-28 07:26:48 -0600

Sarsa-JP gravatar image

updated 2016-01-11 10:06:12 -0600


I would like to know if someone here implemented a module for update Java Plugins on Windows. How did you approach it?

I built a module with the simple task of installing the Java Plugin on our 300+ desktops. I could make it work, and I was trying to make it as simple as possible for others to maintain it. However, Java Plugin is a little piece of work that does not let us uninstall while installing a new version of it, as far as I know. (The irony is that even Flash allows it!)

That said, I implemented an exec resource on my module that subscribes to the new installation and then removes the older version.

Since life is not as simple as we would like to be, to silent uninstall Java we need to provide a uninstall string found in registry.

It works, but the problem is that for each old Java version, the string (of course) is different and I have first to find the current version these desktops have and then provide the right string to my module. (I just implemented Puppet here, and the environment is a mess)

I also built a custom fact to help out, trying to gather versions, but again, Oracle put Java stuff inside a huge code name on its path for each version as well. While we can find version of Flash on their abstract path, this is not true for Java.

My package must come from a UNC path, so we host the exe and msi.

Any clue of how to do that?

Gist of my main simple class (Just a draft (-: ) Gist

Final edit: this is my module that came out of this: Forge ericohtake-javaplugin64

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-12-28 20:17:37 -0600

GregLarkin gravatar image

Is there a consistent place in the registry where you can find the version of the Java plugin? The custom fact route is absolutely your best bet because you want each desktop to present a fact named "javapluginversion" (or similar) to the master for it to use the proper uninstall string like your code shows. A simple case statement in your code could map the fact value to the uninstall string.

I would focus on the custom fact if at all possible, and please post follow-up questions here about that, and we can see if we can get that running for you.

edit flag offensive delete link more


Hi Greg. Firstly, thank you for you support. I agree with you, facts are the best friend in this case. I'm facing a bit of a problem here, since the path in registry for Java differs from each version installed and I lack in experience to be smart in Ruby. I will post below a fact that I adapted.

Sarsa-JP gravatar imageSarsa-JP ( 2015-12-30 12:18:13 -0600 )edit

This is the module I've created after some nights awake. It is not a 5 stars module in the Forge, but I'm willing to improve it.

Sarsa-JP gravatar imageSarsa-JP ( 2016-01-11 10:03:52 -0600 )edit

answered 2015-12-30 12:28:58 -0600

Sarsa-JP gravatar image

So the fact that I adapted to grab the current version from registry is here in this gist.

As long as I have the version 8 update 66, my nodes return the right information. However, for each different version or update, the path is different.


The above is the path for the version 8 update 66 and would be


for the version 8 revision 65. At least they are consistent in this way, where the characters three, four and five from right to left change accordingly to the version/revision.

The same happens for the uninstall strings. I was thinking in an approach where the fact goes to the registry, and look for the part of this key and changes only the numbers related to a given version/revision. Using some case/if to bring the version accordingly and also uninstalling it. Any ideas on how could I start implementing this in my fact?

Btw, happy new year from Tokyo!

edit flag offensive delete link more


Hi Sarsa, Happy New Year to you as well! They sure didn't make it easy for you, it appears! Can you paste a full dump of the registry keys and values for the 2 Java versions you mentioned above? In a situation like this, I would probably lean towards building a table of hard-coded uninstall strings

GregLarkin gravatar imageGregLarkin ( 2015-12-30 18:21:58 -0600 )edit

in the fact source code, assuming you can get all of the ones you want and validate them. Then iterate through the list and return a single string or array of all Java versions detected. I haven't found a list of all known uninstall strings online anywhere, though. The technique shown here:

GregLarkin gravatar imageGregLarkin ( 2015-12-30 18:23:58 -0600 )edit looks for the string "JRE 1" under the uninstall registry key. Perhaps you can use some of that logic in your custom fact to create the list of all currently installed versions of Java. Maybe you have to search for some other string.

GregLarkin gravatar imageGregLarkin ( 2015-12-30 18:25:22 -0600 )edit

Oh great! Thanks for the ideas. Now I have something new to show, which is here: This is an update to the fact that fetches the installed versions as I'm concentrating on this now. I've added a block which looks for key values matching a regex.

Sarsa-JP gravatar imageSarsa-JP ( 2016-01-01 11:33:20 -0600 )edit

In this regex I put the root of the version key, leaving out the version and update numbers. Then I call this while opening the values in the second iteration with registry. It is kind of working, as I've installed both versions in my machine, and I can play with the regex to see the results coming.

Sarsa-JP gravatar imageSarsa-JP ( 2016-01-01 11:35:22 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2015-12-28 07:26:48 -0600

Seen: 207 times

Last updated: Jan 11 '16