Raspberry Pi Integration with NetBeans 8.0

  • Tutorial
In March of this year, a new version of NetBeans 8.0 was released. One of its features was the ability to work through the NetBeans interface with embedded versions of Java SE and ME. Oracle IDE developers are proposing to use the Raspberry Pi with Java SE Embedded remotely as a test platform. I had previously published two translations from MagPi magazine about Java programming on the Raspberry Pi, but mostly they were perceived negatively, since readers did not see anything special in them that was characteristic of such a bundle as Java and Raspberry Pi. I hope that after reading this already original guide, I will be able to soften the position of readers in the matter of the particular approach to Java programming on embedded systems such as Raspberry Pi.

Preparing the Raspberry Pi


Raspberry Pi settings a little. Your Raspberry Pi must be available on the network via SSH, and a working directory must be available for you to read and write to it.

Preparing NetBeans


Before installing the new Java platform on NetBeans, I recommend listening to Leo Priima's short talk on Java SE Embedded 8.



As you can see, from the installation point of view, the main difference between Java SE Embedded and regular Java SE is the need to create separate JRE profiles for installation on devices. In NetBeans 8.0, this functionality is available through the Java Platform Manager.

To do this, select Tools in Java Platforms and click Add Platform ... in the list that opens, point to Remote Standard Edition. Go to the next settings panel of the connection to the Raspberry Pi itself.



After filling in the fields with ip-address, username and password to access Raspberry Pi from your network, it will become possible to create a JRE for this embedded Java platform. The main thing to do:

First , specify the path on your machine where the Oracle Java SE Embedded package is located (you must first download itby choosing a package labeled HardFP ABI, which means the hardware implementation of the mathematical coprocessor module);



Second , indicate the path to the Raspberry Pi where the assembled JRE should be installed.

Next, we expose the options for our platform and save its settings for remote installation on the Raspberry Pi. By default, it will be Compact1, but this is where you can select the profiles that were discussed in the videos and according to them, the built-in Java virtual machine will be installed on the Raspberry Pi. If everything was done correctly, then Java SE Embedded will be installed on the remote device.

We check the work


Well, to verify the work, we will use the 3rd part of the Java article from the 25th issue of The MagPi , creating a project in NetBeans and launching it remotely on our Raspberry Pi.



As you can see, the program written in the shell on the developer's computer was executed remotely on the target device, and the console output via ssh was returned back to the shell. Conveniently enough, at least for me, there is no need to use an interlayer in the form of a software emulator, as for example banking hardware vendors for Visual Studio do.

For convenience you have to pay


There is one caveat to keep in mind, Java SE Embedded includes a commercial license, and if after development you decide to sell your applications (or devices with a preinstalled version of this virtual machine), then you will need to pay Oracle license fees according to the price list .

The cost of the license is indicated on one core and the calculation is carried out according to the following formula:

License cost × Number of chips × Number of cores on a chip × CPU type coefficient × 1.19 = License price Java SE Embedded


A value of 1.19 is an additional charge of 19% of the standard price for updating and support. For example, in our case with Raspberry Pi, the total cost of a Java SE Embedded license for one device will be:

300 × 1 × 1 × 0.002 × 1.19 = $ 0.714


And for an example for ODROID-U3, the price will already be different:

300 × 1 × 4 × 0.0075 × 1.19 = $ 10.71


That is exactly 10 times more, and accordingly the share of license fees relative to the cost of the device itself is about 2% for the Raspberry Pi Model B (at a price of $ 35) and about 16.5% already for ODROID-U3 (at a price of $ 65 ) Therefore, when deciding to use a virtual machine from Oracle as a platform, you need to consider not only the power of the device, but also the cost of the software running on it.

Also popular now: