Installing Java and JavaFX

Before you Begin

If you do not need JavaFX, follow the instructions immediately below. If not, skip those and go to the instuctions on installing JavaFX.

Installing the Java JDK

Install this if you are not doing JavaFX Programming Go to the adoptium.net and do the following. The site automatically detects your OS and offers the correct version.

  1. Download the latest release.
  2. Run the installer. Then do this in a command window in MacOSX or Windoze.
    $javac  -version
    javac 20.0.2
                
    This tells you that java20 is running on this machine. If you run linux, use --version to see the version.

Create this file using your text editor.


public class TestJava
{
    public static void main(String[] args)
    {
        System.out.println("Passed!");
    }
}
        

Navigate your cmd or terminal to the folder containing this file. Then (the $ below is your system prompt), type

$ javac TestJava.java
        

to compile and

$ java TestJava
Passed!
        

to run. You are ready to run and compile Java.

Installing the JavaFX JDK

If you want to do JavaFX, this installs a JDK with JavaFX integrated into it. Visit this page for complete instructions.

Where is the API Guide for JavaFX? Bookmark this!

A Running Start Download s13.pdf for a quick introduction to JavaFX.