Installing Java

rev. 17 November 2021

Installing the Java JDK

Needed for CSC 4240

Begin your journey here. Go to the Adopt Open JDK Site and do the following. The site automatically detects your OS and offers the correct version.

  1. Under Choose a version, choose the latest version (as of 6/2020, it's 16).
  2. Under Choose a JVM, take the default (HotSpot).
  3. Hit the big blue button and download the JDK.
  4. Run the installer. Then do this in a command window. If you run linux, use --version to see the version. This works on MacOSX and Windoze. You will see something like this.
    unix>  java -version
    openjdk version "14.0.1" 2020-04-14
    OpenJDK Runtime Environment (build 14.0.1+7)
    OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
    unix> javac -version
    javac 14.0.1
    

In either case, create this file using your text editor, and name it TestJava.java.

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, and you have all you need for 4240.