Reinstalling an addon

I’ve got a simple add-on that I’ve been writing. I knocked up a simple version and put it in the “addons” directory, and it is working fine.

I’ve now written a better version, but I can’t work out how to replace the old one.
I have naively replaced the jar file in the addons directory with the new one, restarted openhab, but magically it’s still using the old one. From my knowledge of Karaf, restart probably ought not to be necessary due to the magic of OSGi, but I thought just in case.

From the openhab console, bundle:list shows two bundles:

197 | Active    |  80 | 2.1.0.201706021346     | My Binding
199 | Installed |  80 | 2.1.0.201706110704     | My Binding

I expect I would be able to use console commands to stop 197 and start 199, but is this the right way? How do I property uninstall my “old” addon? Clearly it’s copied the add-on somewhere, but I’ve done some “find”-ing and I can’t find it anywhere if it has.

I’ve had a search around and couldn’t find anything anywhere, or failed to hit on the right search term.

Any suggestions?
Thanks.

You could try the karaf uninstall command :wink:

That was my point really. Whether I had to do more than copy the new jar in, whether I was supposed to need to do things in the karaf console to achieve it.

At least part of the issue was that I was missing a requirement. The version of gson in the target definition in Eclipse is 2.5, so I ended up with a requirement on gson 2.5. However the actual openhab 2.1 installation only has 2.3 in, so there’s a mismatch I guess between the target definition and the maven dependency information. Sorting that made things work a little better.

It depends on how the bindings were installed. In theory, if you have only ever installed it by dropping a JAR into the addons, then removing this JAR should uninstall it.

If you’re missing dependancies, then a binding won’t start, but that shouldn’t stop an removed binding from being uninstalled.

Anyway, glad you’re up and running :slight_smile: .