Note: Any recent version of Java will work for this course. The instructions below show Java 11 as an example, but Java 17, 21, or other versions are perfectly acceptable.
Navigate to the following link: https://www.oracle.com/java/technologies/downloads/#java11
Depending on your operating system, select one of the following:

-
It will prompt you to create an Oracle account. Create one, and log in. If you receive a password validation error even though your passwords match, try creating the account in an Incognito/Private/InPrivate window.

-
Download the executable (you can place the executable called
jdk-11.0.30_windows-x64_bin.exeanywhere you want; I usually leave it in the defaultDownloadsfolder). -
Run the executable that you just downloaded (by double-clicking it) and follow through the setup wizard

-
Install it in the default directory.
That's it!
-
If you have a Mac with Apple Silicon, choose the
Arm 64 DMG Installer

-
If you have a Mac with an Intel chip, choose
x64 DMG Installer
-
It will prompt you to create an Oracle account. Create one and log in. If you receive a password validation error even though your passwords match, try creating the account in an Incognito/Private/InPrivate window.

-
Download the executable.
-
Open the
.pkginstaller and follow through the installation instructions

-
Provide your login credentials and click "Install". After installation, you should see the following:

-
Click "close" and you're done!
Note: It's perfectly fine to see version 11.0.xx (where xx is higher than 18) in the above screenshots.
ONE: Open your terminal.
- For MacOS, press Command + Spacebar, type "Terminal", and hit Enter.
- For Windows, press the Windows key, type "Terminal", and hit Enter.
TWO: Run the following command: java -version
You should now see the Java version you're using! (Below is an example of how this looks. I personally have Java 17)

If you run into issues when running these commands after you've installed Java, you may either need to:
- Restart your terminal and run the commands again
- Make changes to your system Path variable (though this is typically not necessary): https://www.java.com/en/download/help/path.html
If you are on Windows, ask on Piazza or come to office hours. We will provide information on this if there's demand.
If you are on a Mac, the following steps will show you how to set the default version of Java to your preferred version (Java 11 is used as an example below).
-
Run the following command:
$ /usr/libexec/java_home -V
You should see output that looks like this:
Matching Java Virtual Machines (3): 12.0.2, x86_64: "Java SE 12.0.2" /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home 11.0.2, x86_64: "Java SE 11.0.2" /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home 1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/HomePlease ensure that you have a Java installation (any recent version will work).
-
Pick your preferred Java version and set it to default by running the following command (Java 11 example):
$ export JAVA_HOME=`/usr/libexec/java_home -v 11`
You can also copy the exact version like this:
$ export JAVA_HOME=`/usr/libexec/java_home -v 11.0.2`
We will be installing Visual Studio Code (VS Code) as our IDE to modify our Java programs.
Note: You can use any text editor (e.g., Vim, Notepad (Windows), TextEdit (macOS)) you want to edit the files in your programming assignments. You also have cloud-based options like GitHub Codespaces, which provides a complete development environment in your browser without requiring local installation. Do not use an Integrated Development Environment (IDE) that automatically generates source code, as 1) you need to learn how to write all source code yourself, and 2) the resulting source code often will fail to compile and/or run in Gradescope, resulting in a score of 0!
-
Navigate to this link: https://code.visualstudio.com/download
-
Follow the installation instructions depending on your OS.
You will create a new Java file named Hello.java in Visual Studio Code.
- Open up Visual Studio Code
a. If you are using a personal computer, you can open
Visual Studio Codelike you would with a normal application.
b. Alternatively, if you are using the terminal (command line), you can type incodeand it should open up Visual Studio Code as well (pretty neat, right?).
You should be prompted with a welcome page that looks similar to the one below:

- Create your working folder!
a. Create a dedicated folder forCSE 11and place it anywhere on your computer (e.g., in the Desktop).
b. Then, inside the CSE 11 folder, create a dedicated folder for your CSE 11 Programming Assignments (e.g., CSE 11 PAs) to stay organized.
c. Then, inside CSE 11 PAs, create one last folder (I promise!) for this small program to live on (e.g., PA0).

-
Now, let's open our
PA0folder inside VS Code so we can start programming!
Click on the Explorer tab and select "Open Folder" in VS Code.

-
Then navigate to the location where you stored
PA0(e.g., Desktop → CSE 11 → CSE 11 PAs → PA0), click onPA0and thenSelect Folder.
- You should see the VS Code explorer showing the
PA0folder (currently empty).
Click on the "New File" icon to create the file for this small program.
- Name this file
Hello.javaand hit Enter. Note that the file name starts with an Uppercase (this is important).
- Copy-paste the code below (this is called boilerplate code, it's code we use in all our programs to make them run!):
public class Hello {
public static void main(String[] args) {
}
}You should see this on your screen:

- Notice that a white circle is next to the file name tab. This means your progress is not saved. Hit
CTRL + Son Windows orCMD + Son Mac to save your file (and the white circle should go away)
- Copy-paste this line inside the main function:
System.out.println("Hello");You should have the following on your screen:

- Open the terminal by going to the
Terminalmenu in the top toolbar, then selectNew Terminal
This will open a terminal for your current folder (i.e., for PA0). You should see the following on your screen:

- To run our program using the terminal, we need to do a two step process:
- Compile
Hello.javaby typingjavac Hello.javain the terminal
and hitting Enter. (This will create some new files with the .class extension, don't worry about them).
- Execute
Hello.javaby typingjava Helloin the terminal (after you compiled in the previous step)
and hitting Enter.
You should see "hello" now! (As shown above).
- Copy-paste this line inside the main function AND before the print line:
String x = "World!";You should have the following now:

- Then, modify the print line so it uses
xto print "Hello World!" as follows:
Note that we added a space after "Hello" (i.e., "Hello "):
- Run the program again using the terminal and our two-step process from above:
That's it! You have successfully used a String variable as input to output your message with the desired word "World!".




