Getting started with Java on the Raspberry Pi
Getting started with Java on the Raspberry Pi
$10.00
Minimum price
$19.00
Suggested price
Getting started with Java on the Raspberry Pi

This book is 47% complete

Last updated on 2019-11-19

About the Book

When I first managed to blink a LED connected to a Raspberry Pi with Java, I was super excited! Controlling physical things with some lines of code is magic! This book includes a lot of info and history about Java itself and how to install it on the Raspberry Pi. Also a lot of tips and tricks to become or be a better developer. And above all many simple examples on these and even more other topics:

  • The magic of Bits and Bytes and solving the confusing of Java signed values with the help of a led number display.
  • Beautiful user interfaces made with JavaFX so you can interact with the hardware.
  • Pi4J applications to be able to control different types of hardware like leds, buttons, displays, led strips, motors, relais boards and many more.
  • Spring applications so you can interact with your Pi via web interfaces.
  • How to setup a queue so you can send and receive messages to and from Arduino boards or other Pi's.
  • And a lot of other inspirational ideas and getting started examples, to be able to build your dream do-it-yourself project.

My goal was to collect all the information I which would have been bundled at the time I started my own experiments with Java on the Raspberry Pi. If you are new to Java, you will learn the language bit by bit by following the examples. As an experienced Java programmer, you will learn how you can extend your knowledge and control the world around you with simple and inexpensive components.

About the Author

Frank Delporte
Frank Delporte

Software developer with more than 25 years of experience in video, multimedia, technical project management, digital signage and (web) programming. Since 2010 working for Televic Rail in Izegem, Belgium.

At work focusing on Java, but also used or using ASP.NET, C#, JavaScript, SQL Server, Flex, CSS, HTML5, Java, Eclipse, Qt...

I love to KISS (Keep It Stupid, Simple) and try to do this in everything I do.

Once a month lead coach of the CoderDojo Belgium club in Ieper where we teach children (7-18) the fun of programming with Scratch, Arduino, Lego Mindstorms, Minecraft...

Table of Contents

  • Chapter 1: Introduction
    • About me
    • Sources and scripts used in this book
      • Where to find them
      • Get the sources
    • Styling used in the book
    • Read the README!
      • Guidelines
      • Example
      • What’s next?
    • Thanks to…
  • Chapter 2: Tools used in this book
    • Software tools on the PC
      • Integrated development environment aka IDE
      • SSH
      • Wiring diagrams
      • Schematic drawings
    • Raspberry Pi
      • Prepare the Pi
      • Connections between Pi and breadboard
      • Extra software on the Pi
    • Hardware components
      • Electronic kit with Arduino board
      • LED strips
  • Chapter 3: About Java
    • History
    • Java files versus byte code
    • JVM versus JRE versus JDK
      • JVM = Java Virtual Machine
      • JRE = Java Runtime Environment
      • JDK = Java Development Kit
    • Version history
      • What has changed in between Java 11 versus 8
      • What’s next after Java 11?
    • JDK providers
      • Oracle
      • AdoptOpenJDK
      • Azul Zing and Zulu
      • BellSoft Liberica
    • Interview with Alexander Belokrylov
    • Install Java on a Pi
      • Raspbian (Buster) has Java 11 pre-installed
      • Downloading and testing BellSoft Liberica JDK
      • HelloWorld! Running a single file Java application
  • Chapter 4: Choosing an IDE
    • Comparing some possibilities
      • IntelliJ
      • Eclipse
      • Netbeans
      • Visual Studio Code (VSC)
    • Program on the Pi 4
    • Interview with the people behind Visual Studio Code
  • Chapter 5: Raspberry Pi pinning
    • Raspberry Pi types
      • Models
      • Major versions
      • Board versions
    • Headers and pins
      • Pin types
      • Pin functions
      • Header types
    • Different pinning numberings
      • Header pin numbers
      • WiringPi numbers
      • BCM numbers
      • PigPio numbers
  • Chapter 6: What is Maven?
    • Install Maven
      • On Windows PC
      • On Raspberry Pi
    • Generate a new Maven project
      • Project structure
      • A minimal pom.xml example
    • Adding logging
  • Chapter 7: JavaFX
    • History
    • Sample libraries to extend JavaFX
      • TilesFX
      • FXRibbon
      • ControlsFX
      • PickerFX
    • Interview met Gerrit Grunwald
    • Minimal JavaFX 11 sample application
      • Add new archetypes to Maven
      • Creating an empty application
      • Running the empty application from Visual Studio Code
      • Building the application for the Pi
      • Running the minimal JavaFX 11 application on the Pi
    • Example 1: TilesFX dashboard
      • Wiring
      • And now with Java
      • And now we start with building our first JavaFX application
    • Start a Java application when the Pi starts up
    • Example 2: Build a UI with FXML
      • Scene builder
  • Just a thought - Beware of the PAF
  • Chapter 8: Bits and bytes
    • Convert bits to a numeric and hex value
    • Calculate a byte value
    • Value ranges in Java
      • Difference between Byte, Short, Integer and Long
      • Minimum and maximum values in Java
      • Signed versus unsigned
      • Conclusion
    • What can we do with this?
      • Web colors
      • Controlling a numeric segment display
  • Chapter 9: PI4J
    • Sample applications
      • Digital output example
      • Digital input example
      • I2C example
      • Infrared receiver
  • Chapter 10: ROBO4J
    • Sample applications
      • Controlling robot motors
  • Chapter 11: Spring
    • What is Spring boot?
    • What is Spring initializr?
    • Example 1: Minimal web server on the Pi
      • Start from the Initializr project and modify pom.xml
      • Swagger config
      • Image controller
    • Example 2: REST webservice on the Pi to toggle a LED
      • Example 3: Database REST webservice to store IoT data on Pi
  • Chapter 12: Message Queues
    •  
      • Publish/subscribe message flow
      • Some example use cases
    • Using Mosquitto on the Pi
      • Installation
      • Testing Mosquitto on the Pi
    • Example 1: Share data between Pi and PC
      • Modifying the pom and module-info
      • Connecting and publishing to Mosquitto
      • Subscribing to Mosquitto
      • The user interface
    • Example 2: Control Arduino from JavaFX via Mosquitto
      • Defining the messages
      • The Arduino part
      • The Java application
      • The finished setup
      • Tip: Checking the network packages between Arduino and Pi
  • Notes

Authors have earned$8,182,613writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. Free App. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub