Reader small image

You're reading from  Raspberry Pi 3 Projects for Java Programmers

Product typeBook
Published inMay 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781786462121
Edition1st Edition
Languages
Right arrow
Authors (3):
John Sirach
John Sirach
author image
John Sirach

John Sirach works as a Product Owner at Greenhouse Innovation. He has more than 10 years of experience with Internet-related disciplines from connectivity to hosting and Internet Of Things. Currently, he is involved in the open source "PiDome Home Automation platform" project as a passionate Java and JavaFX software developer and project maintainer. In the past 10 years, he has gained experience with large-scale web applications committed to online services with the most experience gained in frontend web development and application middleware.
Read more about John Sirach

Pradeeka Seneviratne
Pradeeka Seneviratne
author image
Pradeeka Seneviratne

Pradeeka Seneviratne is a software engineer with over 10 years' experience in computer programming and systems design. He is an expert in the development of Arduino- and Raspberry Pi-based embedded systems. Pradeeka is currently a full-time embedded software engineer who works with embedded systems and highly scalable technologies. Previously, he worked as a software engineer for several IT infrastructure and technology servicing companies. He collaborated with the Outernet project as a volunteer hardware and software tester for Lighthouse- and Raspberry Pi-based DIY Outernet receivers based on Ku band satellite frequencies. He is also the author of five books: Internet of Things with Arduino Blueprints [Packt Publishing] IoT: Building Arduino-Based Projects [Packt Publishing] Building Arduino PLCs [Apress] Raspberry Pi 3 Projects for Java Programmers [Packt Publishing] Beginning BBC micro:bit [Apress]
Read more about Pradeeka Seneviratne

View More author details
Right arrow

Installing and preparing the NetBeans Java editor

At this point we have installed and prepared the Raspbian Linux OS and downloaded and installed Java JDK 1.8 on the Raspberry Pi. Our final step is to install and prepare NetBeans with Java as our editor, which is also used to upload and run the applications on our Raspberry Pi. We will be using NetBeans 8.1 as a reference for installing and preparing.

If you are not used to using NetBeans; no problem, we will go step-by-step with downloading and installing and preparing the application. To install NetBeans on your computer we first need to download the correct version onto our PC or Mac. As NetBeans runs on Java, it is also available for Linux-based OSes. To get NetBeans, go to http://www.netbeans.org and press the Download link on the top right of the page. You will be redirected to the download page, where you will see three download options. As we are focused on Java SE, the first and smallest download will suffice for our projects. Press the download button for the left-most download to download the smallest version. After download is completed, we need to install it. The installation procedure is almost identical for all platforms. All platforms have their dedicated installer, and the installation instructions are linked to on the download page below the show download bundles.

When you open NetBeans for the very first time you will be presented with a welcome screen. You can set a mark in the top-right corner of this welcome screen that says Do not show this again. Otherwise it will show up every time we start up the editor. We will now configure NetBeans in such a way that we are able to write our application on our local computer, and when we want to run our code, let NetBeans upload the application to the Raspberry Pi and run it. We will be able to see all the output we normally would see when we log in on the Raspberry Pi and run the Java application in the output window of the NetBeans editor! This will speed up our projects a lot as we do not need to do any manual actions such as uploading and logging in. To make use of this very handy feature we need to configure a Remote platform. To configure the remote platform with the Raspberry Pi, we will adding it to NetBeans.

First, we will be defining the platform itself. In NetBeans, click Tools | Java Platforms. The Java platforms settings dialog will show up:

On the left bottom, click on the Add Platform button. We are now presented with a selection if we want to add a local or a Remote Java Standard Edition. We select the Remote Java Standard Edition and press Next:

We are now presented with a follow up popup were we can enter the details of the remote platform, which is installed on the Raspberry Pi. In the following screenshot, examples are filled in, which we can use for the remote platform:

We just replace the Host IP address with the address that the Raspberry Pi is reachable on. We keep the Username pi and enter the Password we set during the preparation. We set the path to the JDK installation according to the version we have installed. In the example, it is JDK1.8 build 91. Change the 91 to the build you have installed. We do not press the Create button as the directory is already there. As the working directory, we keep the /home/pi/RASPI3JAVA/, so that we know where all our projects will be placed.

Press the Finish button to have NetBeans verify the remote platform and have it download properties from the remotely installed Java version. This action will take a couple of seconds. When you see the following screen, the remote platform has been confirmed by NetBeans:

We press Close to close the dialog so we can begin with our projects.

Previous PageNext Page
You have been reading a chapter from
Raspberry Pi 3 Projects for Java Programmers
Published in: May 2017Publisher: PacktISBN-13: 9781786462121
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (3)

author image
John Sirach

John Sirach works as a Product Owner at Greenhouse Innovation. He has more than 10 years of experience with Internet-related disciplines from connectivity to hosting and Internet Of Things. Currently, he is involved in the open source "PiDome Home Automation platform" project as a passionate Java and JavaFX software developer and project maintainer. In the past 10 years, he has gained experience with large-scale web applications committed to online services with the most experience gained in frontend web development and application middleware.
Read more about John Sirach

author image
Pradeeka Seneviratne

Pradeeka Seneviratne is a software engineer with over 10 years' experience in computer programming and systems design. He is an expert in the development of Arduino- and Raspberry Pi-based embedded systems. Pradeeka is currently a full-time embedded software engineer who works with embedded systems and highly scalable technologies. Previously, he worked as a software engineer for several IT infrastructure and technology servicing companies. He collaborated with the Outernet project as a volunteer hardware and software tester for Lighthouse- and Raspberry Pi-based DIY Outernet receivers based on Ku band satellite frequencies. He is also the author of five books: Internet of Things with Arduino Blueprints [Packt Publishing] IoT: Building Arduino-Based Projects [Packt Publishing] Building Arduino PLCs [Apress] Raspberry Pi 3 Projects for Java Programmers [Packt Publishing] Beginning BBC micro:bit [Apress]
Read more about Pradeeka Seneviratne