Setting up Java for Tetrad - cmu-phil/tetrad GitHub Wiki

First, click here if you're already an expert at installing Java and want some tips.

If you are a non-expert, this page will explain how to install Java for Tetrad (if you need to).

Note that as of January 2024, we will post all Tetrad jars using Corretto's Java JDK 21 and target language level 21 in the code.

Some interesting background that might help you understand:

  • The abbreviation "JDK" stands for "Java Development Kit" and includes a JRE ("Java Runtime Environment").
  • Installing a JDK ("Java Development Kit") will install Java on your machine.
  • Java JDKs are offered by various companies--Oracle, Amazon ("Corretto"), Adoptium ["Eclipse Tumerin"), Microsoft, IBM, Redhat, etc.
  • Version number for Java may include different integers separated by periods, indicating subversions--e.g., 1.8, 9.1, 9.1.2, etc.; the "major version" is the first number in this period-separated list--for these examples, "11". For 11.3.2, the major version would be "11".
  • Major versions for Java range start at 8 (also called "1.8") and go up to 22. Earlier versions of Java are no longer available.
  • You might have a Mac, Windows, or Linux machine; the installation instructions will differ depending on your operating system.

We encourage you to use version 21 or later of the Java JDK.

You may already have a JDK with major version 21 or higher installed on your machine from one of these companies; in this case, you only need to do a further installation if you want to update your Java.

So...

First, check the version to see if you already have Java with a major version greater than or equal to 21

Open a Terminal window on Mac or Linux or a Command prompt on Windows.

On a Mac, you can hold down the command key, type a space, type Terminal, and return.

Once you have a Terminal open, type the following:

java -version

If a Java JDK is installed, this will print (among other things) the version number of the JDK (for example, "1.8", "8.2", "10.5.3", etc.). You'll have to look for the version number in the printed text. If no version number is printed, you don't have Java installed, so you'll have to install it.

You may close the terminal window using the usual method for closing windows on your machine.

We suggest installing a Java JDK from the Amazon Corretto builds.

We recommend an Amazon Corretto installation with version 21 or higher with long-term support (LTS).

To do this, please go to the Java Downloads page for Corretto to install Java:

https://aws.amazon.com/corretto/?filtered-posts.sort-by=item.additionalFields.createdDate&filtered-posts.sort-order=desc

Here are some tips to follow when downloading--you must make certain choices.

First, you may choose any Java versions offered on this page of version 21 or higher.

Second, select a version for your machine type--Mac, Windows, Linux.

Now, the instructions depend on which machine type you have. You need to select which install file to download.

Further instructions for installing your selected version are given on the Amazon Corretto page.