Site iconJava PDF Blog

Remotely deploy projects to the Raspberry Pi using NetBeans IDE

The Raspberry Pi is not a very powerful device, however as it is so flexible, it is a very useful machine to have to test programs on. However actually programming and building your programs on the Pi itself would be far too time-consuming to make the testing worthwhile.

NetBeans solves this problem with ease by allowing you to program and build your projects on your usual machine (likely a lot more powerful than the Pi!) and then send and run the built project on the Pi.  Programs such as PuTTy aren’t necessary as NetBeans does all the work for you – that means no SSH setup required! Your program then runs on the Pi as you would expect but with the added bonus of all outputs and debugging information being sent back to your machine where it is displayed in the normal Output window.

I’m now going to show you how to do this by deploying our Java PDF Library SDK to the Pi.

Requirements:

 

 

Steps:

 

  1. Setup the connection between the Pi:
    •  – Open the Project Properties window of the project you want to deploy
    •  – Select the Run tab, click Manage Platforms then Add Platform
    •  – We then select Remote Standard Java Edition and proceed to fill out the form
    •  – I’m going to give it a Platform Name of “Pi Config”
    •  – The Host field is for the IP address of the Pi
    •  – The default Username is “pi” and the Password “raspberry”, but if you have changed the login options on the Pi, then you will need to change those here as well
    •  – The Remote JRE Path for our Pi was: “/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre/bin/java”, but it might well be different on yours. Once all the boxes are filled in, click finish to complete the setup.  If NetBeans says it can’t connect to the host, then verify that all the fields contain the correct information
Remote Java Platform

 

Project Properties

Thats it for the configuration of the project. Now we just need to run the program!

To do this, firstly make sure the Pi hasn’t been booted to the desktop.  If you are on the desktop, logging out should return you to the correct command line.  Now all you need to do is hit Run in NetBeans and your project should magically appear on the Pi!

I hope you’ve enjoyed our article, please let us know in the comments below.