To be able to develop in Java one requires a JDK - Java Development Kit. You have to download and properly set up java
To be able to develop in Java one requires a JDK - Java Development Kit. You have to download and properly set up java
For IT1901 either JDK 11 or 12 will do just fine.
For IT1901 either JDK 11 or 12 will do just fine.
## Install java
## Install java
If there is no Java Development Kit installed or the version is not what you need (we recommend version 11 or 12) then proceed to download JDK and install it.
If there is no Java Development Kit installed or the version is not what you need (we recommend version 11 or 12) then proceed to download JDK and install it.
After the download finishes you have in the destination folder the `.zip` file with a name like this `openjdk-12.0.2_windows-x64_bin.zip`. Right click it and extract the contents.
After the download finishes you have in the destination folder the `.zip` file with a name like this `openjdk-12.0.2_windows-x64_bin.zip`. Right click it and extract the contents.


Copy the extracted folder in a meaningful location on your hard drive like for example in `C:\jdks`
Copy the extracted folder in a meaningful location on your hard drive like for example in `C:\jdks`


#### Set up the environment variables
#### Set up the environment variables
To properly set up Java on your machine you need to set couple environment variables. To do that you need to open "Environment variables" dialog box.
To properly set up Java on your machine you need to set couple environment variables. To do that you need to open "Environment variables" dialog box.
There are several ways to get to that dialog box.
There are several ways to get to that dialog box.
Right click "This PC" and select "Properties"
Right click "This PC" and select "Properties"


You should see a window like the one below. Choose "Advanced System Settings" option in the top left side.
You should see a window like the one below. Choose "Advanced System Settings" option in the top left side.


A new window will open showing "System properties"
A new window will open showing "System properties"


Open "Environment Variables"
Open "Environment Variables"
If the JDK should be available for all users than make the environment variable changes at system level otherwise do them at user level.
If the JDK should be available for all users than make the environment variable changes at system level otherwise do them at user level.
Check if there is already a `JAVA_HOME` environment variable. If it is change the value to the path to your JDK (`C:\jdks\jdk-12.0.2`)
Check if there is already a `JAVA_HOME` environment variable. If it is change the value to the path to your JDK (`C:\jdks\jdk-12.0.2`)


Next we need to add the `bin` folder within the JDK folder to the `PATH` environment variable so that the java commands are accessible from the command prompt
Next we need to add the `bin` folder within the JDK folder to the `PATH` environment variable so that the java commands are accessible from the command prompt


Finally we can check if java is now running as expected
Finally we can check if java is now running as expected


##### Notes
##### Notes
* You can check the values of environment variables from command prompt issuing commands such as `SET JAVA_HOME` or `SET PATH`
* You can check the values of environment variables from command prompt issuing commands such as `SET JAVA_HOME` or `SET PATH`
* You can get to the environment variable dialog by other means
* You can get to the environment variable dialog by other means
** search "env" in the windows start menu
** search "env" in the windows start menu
** open System from the Control Panel and then "Environment Variables"
** open System from the Control Panel and then "Environment Variables"
### Linux
### Linux
#### Check if there is any java installed
#### Check if there is any java installed
Open a terminal window and type
Open a terminal window and type
``` bash
``` bash
java -version
java -version
```
```
### MacOs
### MacOs
#### Check if there is any java installed
#### Check if there is any java installed
Open a terminal window and type
Open a terminal window and type
``` bash
``` bash
java -version
java -version
```
```
## Download Java
## Download Java
### Open-source reference implementation (GNU GPL License, provided by Oracle)
### Open-source reference implementation (GNU GPL License, provided by Oracle)
* 1. go to http://jdk.java.net
* 1. go to http://jdk.java.net


* 2. select the general available build (currently 12)
* 2. select the general available build (currently 12)


* 3. download the binary corresponding to your operating system
* 3. download the binary corresponding to your operating system
### Get binaries from Oracle site (Oracle license)
### Get binaries from Oracle site (Oracle license)
1. go to https://www.oracle.com/technetwork/java/javase/downloads/index.html
1. go to https://www.oracle.com/technetwork/java/javase/downloads/index.html
2. sign in (if you do not have an account you will need to create one in order to be allowed to download)
2. sign in (if you do not have an account you will need to create one in order to be allowed to download)
3. select the latest (currently 12)
3. select the latest (currently 12)
4. download the binary corresponding to your operating system
4. download the binary corresponding to your operating system
There are more choices for downloads. Typically a .zip or .tar.gz would imply manual setup while the .exe, .deb, .rpm, .dmg will provide some sort of installer support.
There are more choices for downloads. Typically a .zip or .tar.gz would imply manual setup while the .exe, .deb, .rpm, .dmg will provide some sort of installer support.