• facebook
  • Twitter
  • LinkedIn
  • reddit
  • Hacker News
  • Print
  • facebook
  • Twitter
  • LinkedIn
  • reddit
  • Hacker News
  • Print
  • facebook
  • Twitter
  • LinkedIn
  • reddit
  • Hacker News
  • Print

Are you just getting started with Java How to Program, 11/e, Early Objects versionJava 9 for Programmers or Java How to Program, 11/e, Late Objects version? You will need to install the Java Development Kit (JDK).

Getting the JDK

Updated January 11, 2021

As of this writing, the Java 15 is the current version and new versions are being released every 6 months—Java 16 is coming in March. For organizations interested in stable versions of Java with long-term support (LTS), these will be released every three years. The current LTS version is Java 11 (September 2018). The next LTS version will be Java 17 in September 2021. 

Oracle, Inc.—Java’s gatekeeper—offers the JDK for download from oracle.com, but Oracle recently changed their licensing terms. Their JDK is meant primarily for corporate users

For learning purposes, we recommend that you get your JDK from AdoptOpenJDK.net. Always read the software licenses for any software you install.

Once you’ve downloaded the installer for your operating system platform and the version of Java you intend to use, be sure to carefully follow the installation instructions for your platform (found further down the page).

Java FX for Graphical User Interfaces

Since Java 11, the graphical user interface (GUI) library we use in our Java books—Java FX—is no longer distributed as part of the Java Development Kit.

To run the first example in Chapter 1 and the examples in our later Java FX chapters, you’ll first need to install the Java FX Software Development Kit (SDK).

The Java FX SDK installation instructions are at https://openjfx.io/openjfx-docs/. You can download the JavaFX SDK from https://gluonhq.com/products/javafx/.

Be sure to download the version that matches your JDK version number and your platform and closely follow the installation instructions.

If you’re unsure what to download, please send us an email. You’ll need to set your PATH_TO_FX Environment Variable. This depends on where you place the SDK’s folder on your system and what version of the SDK you have. The samples below assume the Java FX SDK’s folder is in your user account’s Downloads folder. In the paths I show below, you need to replace

     “/Users/pauldeitel/Downloads/javafx-sdk-15.0.1”

or

     “c:\Users\pauldeitel\Downloads\ javafx-sdk-15.0.1”

with the correct full path on your system and the JavaFX SDK version number for the specific version you downloaded.

Mac/Linux:

     export PATH_TO_FX=/Users/pauldeitel/Downloads/javafx-sdk-15.0.1/lib

Windows:

     set PATH_TO_FX="c:\Users\pauldeitel\Downloads\javafx-sdk-15.0.1/lib"

Compiling and Running the Painter App in Chapter 1

To compile the Painter app in Chapter 1 use the following command in your Command Prompt (Windows), Terminal (macOS or Linux) or shell (Linux)—Windows users should replace $PATH_TO_FX with %PATH_TO_FX%

     javac --module-path $PATH_TO_FX --add-modules=javafx.controls,javafx.graphics,javafx.fxml *.java

To run the Painter app, use the following command—Windows users should replace $PATH_TO_FX with %PATH_TO_FX%

     java --module-path $PATH_TO_FX --add-modules=javafx.controls,javafx.graphics,javafx.fxml Painter

If you’re having any trouble at all, please send us an email. We’re happy to help you get up and running!

Pin It on Pinterest

Share This Page