Geertjan's Blog

  • November 4, 2014

Execution Wrappers for IoT Development in NetBeans IDE 8.0.1

Geertjan Wielenga
Product Manager

Assuming you're doing IoT development and want to run an application to a remote platform that needs to interact, for example, with the Raspberry Pi
GPIO, you need to have write access to the virtual files of the kernel.

For example, if that program is executed without "root" rights, it might crash with the following error:

Before NetBeans IDE 8.0.1, a workaround that Jens Deters came up with to circumvent the above problem, was to call a shell script that does the job, as follows:

  1. Rename "/opt/jdk1.8.0/bin/java" to "/opt/jdk1.8.0/bin/javaX".

  2. Create a shell script located in "/opt/jdk1.8.0/bin/" named "java" (as a replacement of the original "java" command“) containing this code:

Now, when the application is run via the above script, the output should be as follows:

However, in NetBeans IDE 8.0.1, there's great news. You can now set an execution prefix, such as "sudo", and then the workaround above is obsolete. As you can see below, when the properties of the remote platform, e.g., your Raspberry Pi, are set in NetBeans IDE, you can include an execution wrapper for the first time:

The above new feature comes from a user request, here:


This subtly handy feature fits into a range of integrated tooling that makes NetBeans IDE such a natural choice for anyone creating software in Java for purposes of IoT development, as outlined in detail here by multiple Java developers, including James Gosling himself:

"After having spoken about the ‘Internet of Things’ for decades, I’m thrilled by the extent to which, for ordinary developers, this has been exploding beyond cell phones. NetBeans embedded support makes this development painless, fluid, and fast-paced. Being able to debug a running robot, at sea – or wherever your robot goes – from a thousand miles away, is truly life-altering."

I.e., if you're messing around with IoT devices via Putty, WinSCP, SSH, and a bunch of other command line tools... please, do yourself a favor, and just stop doing that. Just download and install NetBeans IDE 8.0.1, for free, and then install the following plugins: None. Yes, no plugins needed for IoT development in NetBeans IDE, everything described here, all IoT features, are waiting for you to use them, out of the box.

The fact that the feature set for IoT with Java 8 in NetBeans IDE (full create/edit/debug/profile lifecycle that fits into the standard Java development workflow in NetBeans) is now in its second generation, i.e., these features were initially released in 8.0, enabling the 8.0.1 release to focus on finetuning of the existing feature set based on user feedback and interaction, makes for a set of tools that is very hard to beat at this stage.

More similar quotes about Java editing, debugging, and profiling of Java on IoT devices here: http://jaxenter.com/how-to-deploy-debug-and-profile-java-on-the-raspberry-pi-2-108008.html

Many thanks to Jens Deters for the great explanation above, i.e., the text above with the practical example and earlier workaround is more or less copy/pasted from a mail received from Jens, together with the helpful screenshots.

Join the discussion

Comments ( 2 )
  • guest Wednesday, November 5, 2014

    Really great news! NetBeans is getting better and better... I have given up to search for a better IDE!

  • guest Wednesday, November 5, 2014

    great, but a maven based project can't be executed/debugged remotely?

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.