diff --git a/howto/get-java.md b/howto/get-java.md new file mode 100644 index 0000000000000000000000000000000000000000..50b3a3ce29f2457a0de10d6f5c7442d089ccbd37 --- /dev/null +++ b/howto/get-java.md @@ -0,0 +1,121 @@ +# Setting 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. + + +## 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. + +### Windows + +#### Check if there is any java installed + +In a command line window type: + +``` batch +java -version +``` + + +#### Extract downloaded binary + +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` + + + + +#### 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. +There are several ways to get to that dialog box. + +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. + + + +A new window will open showing "System properties" + + + +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. + +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 + + + +Finally we can check if java is now running as expected + + + +##### Notes + +* 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 + ** search "env" in the windows start menu + ** open System from the Control Panel and then "Environment Variables" + + +### Linux + +#### Check if there is any java installed + +Open a terminal window and type + +``` bash +java -version +``` + + +### MacOs + +#### Check if there is any java installed + +Open a terminal window and type + +``` bash +java -version +``` + + +## Download Java + + +### Open-source reference implementation (GNU GPL License, provided by Oracle) + +* 1. go to http://jdk.java.net + + + +* 2. select the general available build (currently 12) + + + +* 3. download the binary corresponding to your operating system + + +### Get binaries from Oracle site (Oracle license) + +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) +3. select the latest (currently 12) +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.