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 Open Source JavaFX PDF viewer, OpenViewerFX  to the Pi.

 

Requirements:

 

  •  – NetBeans 8.0 or greater.
  •  – Raspberry Pi running Java 1.8.0 (with JavaFX installed)
  •  – Both the development machine and the Pi need to be connected to the Internet (I connected them both to them same network)
  •  – A NetBeans project that you want to deploy to the Pi

 

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
raspberry pi configuration

Remote Java Platform

 

        •  – NetBeans will now ask you for a name for the Runtime Platform. Call it Remote Pi.
        1. 2. You should now be taken back to the Run tab of Project Properties where we are now going to finish the configuration of the project:
          •  – Make sure the Runtime Platform is “Remote Pi”
            1. TIP: If you ever want to run the project on your local machine rather than the Pi, just change the Runtime Platform to the default via the drop-down menu
          •  – I have added an argument so the PDF viewer opens a PDF file automatically, however your project may not need this.
raspberry pi project properties

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.

 

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the Blog RSS.

  • Try PDF to HTML5 and SVG for Free
The following two tabs change content below.
Richard Bound is a developer at IDR Solutions focusing on JavaFX development and internal continuous testing on Hudson and Jemmy. He enjoys programming with a focus on Java programs and Android apps. In his spare time, if he is not working on his development projects, he is probably somewhere doing sport.

Latest posts by Richard Bound (see all)

Related Posts:

Richard

About Richard Bound

Richard Bound is a developer at IDR Solutions focusing on JavaFX development and internal continuous testing on Hudson and Jemmy. He enjoys programming with a focus on Java programs and Android apps. In his spare time, if he is not working on his development projects, he is probably somewhere doing sport.

6 thoughts on “Remotely deploy projects to the Raspberry Pi using NetBeans IDE

  1. Martin Nash

    Thank you for this article.
    I install jdk1.8.0_06-oracle-arm… sucessfully without javafx. If i am right is fx optional.
    Java -version have show me a the right version.
    My Netbeans 8 configuration for a new project does not work until now.
    I checked the right jre path but i think the connection may be blocked.
    Do you know what Kind of protocol netneans use for this.?

  2. shipmodeller

    I installed this today, and other than having to put the jre path in WITHOUT the trailing /bin/java … it appeared to test fine on my pi’s.

    However, I cannot compile and run on them, because netbeans says that

    ant -f C:\\ThrowARockLibrary -Dremote.platform.password=***** -Dremote.platform.rp.target=linuxarmvfphflt-15 -Dremote.platform.java.spec.ver=18 -Dremote.platform.rp.filename=linuxarmvfphflt -Dnb.internal.action.name=run run-remote

    Target “run-remote” does not exist in the project “ThrowARockLibrary”.
    BUILD FAILED (total time: 0 seconds)

    What did I do wrong??? What do I need to add to what to make thisrun.

  3. shipmodeller

    Ok, solved problem,… you cannot use an EXISTING project. Oce I created a NEW version of the library, and before I did my first compile, I set up the remote … It now works as expected.. almost.

    I can run the project, and the targetted class will run on the remote device. But if I do a run file.. the run file is executed on the local device. Is this a bug, or is there something else i missed???

    Thanks..

  4. markiewb

    You should also state that only ANT-based projects are supported right now (NetBeans 8.0.2). No Maven-support yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>