⬆️ ⬇️

Raspberry Pi integration with NetBeans 8.0

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's IDE developers suggest using Raspberry Pi with Java SE Embedded installed remotely as a test platform. Before, I had already published two translations from the MagPi magazine about Java programming on the Raspberry Pi, but mostly they were perceived negatively, because the readers did not see in them anything special, characteristic of such a bundle as Java and Raspberry Pi. I hope that after getting acquainted with this already original manual, I will manage to soften the readers' position on the issue of the features of the approach to Java programming on embedded systems like Raspberry Pi.



Prepare Raspberry Pi



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



Preparing NetBeans



Before installing a new Java platform in NetBeans, I recommend listening to a small talk by Lev Priyma on Java SE Embedded 8.

')





As you can see, in terms of installation, 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 Java Platforms in Tools and click Add Platform ... in the list that opens, point to Remote Standard Edition. Go to the next settings panel already connecting to the Raspberry Pi.







After filling in the fields with ip-address, username and password to access Raspberry Pi from your network, it will be 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 it by selecting the package marked HardFP ABI, which means the hardware implementation of the math coprocessor module);







Second , specify the path to the Raspberry Pi where to install the assembled JRE.



Further we set options for our platform and save its settings for remote installation on the Raspberry Pi. By default, this will be Compact1, but it is here that you can select the profiles mentioned 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 test the work, we will use the third part of the Java article from the 25th issue of The MagPi magazine , creating a project in NetBeans and running 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 is returned back to the shell. Conveniently enough, at least for me, there is no need to use a layer in the form of a software emulator, as vendors of iron for Visual Studio do, for example.



For convenience you have to pay



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



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



License cost × Number of chips × Number of cores on a chip × Processor type ratio × 1.19 = Price of license Java SE Embedded





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



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





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



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





That is exactly 10 times more, and accordingly the share of licensing fees in relation to the cost of the device itself is about 2% for Raspberry Pi Model B (at a price of $ 35) and about 16.5% already for ODROID-U3 (at a price of $ 65 ). Therefore, 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.

Source: https://habr.com/ru/post/219191/



All Articles