In preparation for the talk G-Force! Self-Powering Global Sensor Nets for IoT that Mark Heckler (@MkHeck) and I will give in a few days in the IoT track of JFokus 2014, we’ve been using the brand new beta version of NetBeans IDE 8 to deploy, debug, and run two of the three different projects required. We use three different Raspberry Pis for three different tasks:
Pi “Remote”, in the backend, with a Java SE project
Pi “Master”, the server, with GlassFish 4.0 (Web Profile).
Pi “Client”, the client, with a JavaFX (SE) project
The communications between the three of them is done via WebSocket. In the backend, the Pi gathers readings from several sensors installed via serial port and also controls a few connected devices. In the client, the user can see values in real time, charts with data for a selected period of time, or command the devices.
Here are two pics of our systems. The first one is the backend in Mark’s shed, where all the sensors are powered with renewable energy coming from a small wind turbine and three small solar panels.
The second is my own setup, with the three Raspberry Pis on my table, just when I’m deploying a JavaFX client from my laptop to the Pi on the left, which is connected to the monitor. The server is embedded in a Lego case to hold a Pi camera, and the third one has an XBee antenna to wirelessly connect to the Arduino on the right.
Except for the server, for the other two SE projects, the new capability of NetBeans IDE 8.0 beta that allows you to select a Remote Java Standard Edition platform comes in really handy, as it greatly simplifies the process of deployment and debugging on the Pis.
You just need to provide the IP address, username, password and the JRE/JDK path of the Pi (on the LAN, with SSH enabled).
After that, simply go to Properties->Run, select the Remote platform, and add a configuration file (providing a name for it), and you’ll be able to run your project on the Pi. If you want, you can run it locally too, just by selecting the default configuration file (Run, Set Project Configuration).
NetBeans will take care of sending the dist folder with the jar and its dependencies to a folder on the Pi (by default /home/pi/NetBeansProjects/<project’s name>), running and even debugging it remotely as if you were running the project on your own computer, with all the console messages in your output windows. You just have to keep in mind that you’re on the tiny Pi.
Once again, kudos to the NetBeans Team!