Installing Java
To install Java you need to install the Java Development Kit (JDK). It can be downloaded from here: https://jdk.java.net/13
You will want to select the zip download for Windows.
Hover to zoom
After downloading the zip you will want to unzip it (into a folder, should by default) and then copy that folder into C:\Program Files\Java\
Hover to zoom
When I did this myself, it unzipped into a folder jdk-13.0.1
. By the end you should have the following folder structure: C:\Program Files\Java\jdk-13.0.1
Setting up your environment
In order to make the JDK discoverable by your programs you need to add the JDK folder to your PATH environment varible. This is best done by first setting up a varible for the java directory JAVA_HOME
that points directly to the directory you copied the unzipped files into.
Hover to zoom
Once you've setup the JAVA_HOME
variable you can add that varible to your PATH point to the subdirectory /bin
. This can be confusing if you haven't done this before. Here is a StackOverflow article how to add environments variables in Java 10.
Hover to zoom
Optionally, if you want to test that this worked, you can open up the command prompt (or powershell) by opening the start menu and typing/looking for cmd.exe. Then you can type java -version
which will output the version and some additional information. You should see java version 13.0.1
.
IntelliJ Community Edition
I recommend using IntelliJ Community Edition instead of Eclipse. They're both open source but I use IntelliJ at my job daily and its a fantastic, out of the box editor. Where Eclipse requires a lot more setup steps and plugins to get it to be "complete". Feature wise they do the same things, so everything they do in Udemy via Eclipse should work in IntelliJ.
Downloading
To Download go to www.jetbrians.com/idea/download and click the Exe download for community edition.
Hover to zoom
Once the download is complete you can run the installer. You should select your theme, then just use the "Install defaults" option at the bottom, or just Next through the rest of setup, as you shouldn't need any additional plugins. And if you do they all can be installed later
You're Done! You can start Udemy now just ignoring their install/setup instructions. I have some additional steps below to help verify everything works and do some basic operatoins in IntelliJ (Create a Project, Create a class, Run/Debug) but you can refer back to here once you get there in Udemy
Using IntelliJ
Jetbrains actually has a whole FAQ/Tutorial section that can help you with any questions too. But here is a brief overview of the core functions of IntelliJ
Creating a project
When you first open IntelliJ it shows a splash screen where you can open an existing project or create a new one. You will at first want to create a new project.
Hover to zoom
You want to choose a java (the default) and select the version of the JDK (should default to 13.0.1, if not click browse and navigate to the folder you copied it to from the first step: C:\Program Files\Java\jdk-13.0.1
.
Hover to zoom
Then you can name the project and choose the directory you want to files in.
Hover to zoom
Now you should have a project setup that you can create your program in!
Hover to zoom
Creating a class
To create a class in IntelliJ you should expand the projects menu on th left side and right click the src
folder. You then select "create class". This will add it directly into your src folder.
Hover to zoom
From here you can start writing code!
Hover to zoom
Running a Program
Java code is executed from the main method public static void main(String[] args)
. You can run your main method by either right clicking within it and selecting run. Or when the file containing your main method is open using the Run button at the top right of the editor.
Hover to zoom
Debugging a Program
To debug you can set breakpoints in your code by selecting the left hand side by the line numbers. This will add a red dot which tells the program to pause executing when it reaches the code at that line. To do this you need to run in debug mode (rather than plain run mode) by right clicking your main method and choosing Debug, or by using the debug icon at the top right of the editor window.
Hover to zoom
Additional Help
If you need any help at all feel free to text or email. If its a code issue, either a screenshot of the code or the code itself will help!