Using NetBeans for OpenHAB 2

Tags: #<Tag:0x00007f616e49f0a8> #<Tag:0x00007f616e49ef40> #<Tag:0x00007f616e49ee00>

I’m trying to set up a development environment for OpenHAB 2 in NetBeans. I’m making notes as I go along and will make these available when I’ve finished.

Compiling and building the relevant OpenHAB 2 projects is straight-forward and much easier than with OpenHAB 1. Congratulations to those responsible.

Having built the projects, I’d like to be able to run and debug them also from NetBeans. This is where the problems seem to start. The stuff in the launch directory (openHAB2.setup, openHAB_Runtime.launch, is all pure Eclipse microcosm as far as I can tell.

To start an OSGi project in NetBeans I have in the past defined two actions, run project and debug project, which use org.codehaus.mojo:exec-maven-plugin:1.2.1:exec with appropriate arguments to start the project. Where can I find an explanation of what Eclipse does so I can translate it into something similar that NetBeans can handle? Is there currently a way of starting the runtime with Maven?

On the naive assumption that it’s easier, I’m working initially from the offline distribution and trying to understand from target/karaf/bin what is needed. Is there a better approach?


I’ve managed to configure NetBeans 8.2 to compile and build OpenHAB 2.0.0. I can run OpenHAB from NetBeans too. I haven’t been able to test the debugger yet though.

I’ve created a new binding to test the whole build process. I created a skeleton using, and the binding gets compiled and built alright. However, it’s not finding its way into openhab-addons-2.0.0-SNAPSHOT.kar and thus does not appear in PaperUI.

Any suggestions that might help me to fix this?


I’m aborting this exercise.

I could probably find work-arounds for the Eclipse-specific stuff, given enough time, but the whole build process is sooooo slow that I’m dying of boredom. The Maven stuff behaves in a way I have never seen before: instead of only modifying what has been changed since the last time, it appears to attempt at every build to download everything it needs and to rebuild/reprocess most of it. Edit-build-test cycles are ineffective (and not a lot of fun) when the build part lasts between 45 and 60 minutes…

If anyone else wants to take up the challenge I’ll provide what I know on request. But I give up.


Hi @stephen_winnall,

I hope you don’t give up on Netbeans + openHAB2. Particularly I’d love to see Netbeans replace Eclipse for editing the openhab-conf stuff (e.g., sitemaps, etc.) as the Eclipse smart home editor is so inconvenient, inflexible and everything was stripped off that could be useful (like refresh the directory tree when a file was added since adding a file is not possible, etc.).

Though I can’t help building it, I hope some moral support is also helpful.


1 Like

[quote=“antares2001, post:4, topic:19684”]
Hi @stephen_winnall,

I’m also trying to set up Netbeans but have multiple problems. The main problem is that of missing dependencies. When I fetch them compiling fails.
Would be great if you could give me a, hopefully, detailed description of what to download and how to set up everything to get it to work. I am only interested in developing a addon but have learned that I need more than just a addon master download.
Hope you can help.


Hi @pedeho. I too only wanted to write an add-on (an EnOcean binding), but the build process seems to be too Eclipse-specific. I never managed it under Netbeans and finally gave up in disgust.

I suppose we could try petitioning the project leadership. If they realise stuff is not getting done because people who don‘t use Eclipse are being shut out, they might consider modifying the build process.

However, in my case, although I had time for OH2 development at the beginning of the year, I haven‘t now or in the next twelve months. So I won‘t be complaining loudly.


Hi Stephen.

I did find out. Finally. Wrote a IHCServer binding (for the old IHC
controller) without to much trouble. Did a lot of experimenting which
resulted in almost endless maven downloads. I suppose it would be best
if I do a new setup again and write down how I got it to work. I’ll be
back :slight_smile:


The endless Maven downloads sound familiar :wink:


Did you get anywhere with a process for netbeans? I too would like to write a plugin, but I’l only going to be able to have enough time, if i can do it in netbeans.

I didn’t back then. But last week I downloaded the sources of OH3 and compiled them using Netbeans 11. I haven’t tested it yet, but it seems to have compiled OK, which was not the case back in the day (too much Eclipse-specific technology).

It would be great if “vendor and technology agnostic” finally applied to IDEs: it used to be a bit of a joke :slight_smile:


To give some background. In 2019 the build system was changed from Tycho (Eclipse specific) to a bnd/maven build system. This made it IDE independent and there is already documentation on using VisualStudio Code and IntelliJ See Certainly the descriptions of those 2 other ide’s might help as a template to setup Netbeans. And if you have something working it might be great to add a new page to the documentation with the steps to setup Netbeans.

Hi Hilbrand

That’s good news. Thanks for the update. Since it’s now Maven, in Netbeans it should just work. I’ve seen nothing to suggest that it doesn’t. I’ll take a closer look when I’ve finished with my current distractions.


I have managed to compile this with netbeans so that’s a start. I have made the default skel project and build it too. So, I think I can progress from here.

How is the best way to test this? It’s build a jar in the new addons root folder. How do you install this in a working openhab. I copyied it to the addons folder of my running OH, and then had a look in configire bindings in PaperUI to see if i could see any sign of it, but nothing…

What’s the best way to test the addon in OH during development?

Copying the file to the addons folder is the right way. If it doesn’t appear, start by logging into karaf and run bundle:list to see if it shows up there. Otherwise it might be a permission issue. Run sudo chown openhab:openhab your.jar.file.jar (assuming you run oh on linux, not sure if windows is picky about ownership) and check again in karaf.