Development Environment Set Up: Java
Recommended completion before Monday's class but definitely before Wednesday's class
Objective
To get your development environment set up for Java.
Installing Java's Development Kit
If you plan to work only on the lab machines, you can skip this step, but it's probably helpful to have Java installed on your personal machine(s).
We will be using the newest long-term support (LTS) version of Java: 21. Specifically, I recommend that you get Liberica, a free, supported, 100% open-source OpenJDK. Make sure you get the JDK (which includes the JRE), not only the JRE. Also, make sure you get the version that is appropriate for your machine's processor.
After installing, on the command line, confirm that you're using
Java 21 by running
java -version
javac -version
and seeing that the version is
21.
If you had previously installed Java, you may see an older version number. While that likely won't be a problem with the level of code we'll be writing, I'd prefer to avoid any issues.
If you get an error that says something about "Bad CPU", make sure you have installed the version that is appropriate for your machine's processor.
Check Java Development Environment
After Monday's class but before Wednesday's class
- Create a new directory within the directory that you're using
for this class, e.g.,
practice
- Download First.java and save it in your
practice
directory. - In your terminal, navigate to your
practice
directory. - Compile and run
First.java
:- javac First.java
Compiles the program intoFirst.class
List the contents of your directory to seeFirst.class
- java First
Runs the JVM, which executes the bytecode
- javac First.java
- View
First.java
in your favorite text editor, e.g., if your text editor isjEdit
, you'd run
jedit First.java &. - Review the components of the program. Make sure you understand why the code outputs what it does.
Submitting your assignment
No submission. This is just on your honor that you do it, so you're ready for future work.