Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Raspberry Pi 3 Projects for Java Programmers
  • Table Of Contents Toc
  • Feedback & Rating feedback
Raspberry Pi 3 Projects for Java Programmers

Raspberry Pi 3 Projects for Java Programmers

By : Chandra, John Sirach, Seneviratne
close
close
Raspberry Pi 3 Projects for Java Programmers

Raspberry Pi 3 Projects for Java Programmers

By: Chandra, John Sirach, Seneviratne

Overview of this book

Raspberry Pi is a small, low cost and yet very powerful development platform. It is used to interact with attached electronics by the use of it's GPIO pins for multiple use cases, mainly Home Automation and Robotics. Our book is a project-based guide that will show you how to utilize the Raspberry Pi's GPIO with Java and how you can leverage this utilization with your knowledge of Java. You will start with installing and setting up the necessary hardware to create a seamless development platform. You will then straightaway start by building a project that will utilize light for presence detection. Next, you will program the application, capable of handling real time data using MQTT and utilize RPC to publish data to adafruit.io. Further, you will build a wireless robot on top of the zuma chassis with the Raspberry Pi as the main controller. Lastly, you will end the book with advanced projects that will help you to create a multi-purpose IoT controller along with building a security camera that will perform image capture and recognize faces with the help of notifications. By the end of the book, you will be able to build your own real world usable projects not limited to Home Automation, IoT and/or Robotics utilizing logic, user and web interfaces.
Table of Contents (7 chapters)
close
close
4
Integrating a Real-Time IoT Dashboard

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.

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY