Thursday, December 27, 2018

Java Tutorial: Installation

References/Links:  http://pasted.co/1667778f

Chapters

Java Packages and Editions

Hello Everybody and welcome to my tutorial in this tutorial I'll show on how to install java on your computer. Java has different platform editions
:
 Java SE(Standard Edition) which provides the core functionality of java programming language. We will be using Java SE to create projects throughout my java tutorial(Due to Oracle license changes in Java SE 11, I decided to use OpenJDK11 instead of Java SE 11 in my newly created tutorial, I'll provide an instruction on how to install OpenJDK11 on Windows 7 later). 

Java EE(Entreprise Edition) which is built on top of the Java SE platform and it provides an API(Application Programming Interface) and runtime environment for developing
and running large-scale, multi-tiered network applications. 

Java ME(Micro Edition) which provides an API for running java applications on small devices. 

JavaFX is a platform for creating rich internet applcations using a lightweight user-interface API, JavaFX in now part of JRE/JDK(In OpenJDK11 you need to install IcedTea-Web to add JavaFX/OpenJFX support, I provided a link in the description).

Java has a Java Runtime Environment(JRE) and Java Development Kit(JDK), if you just want to run a java application on your computer then you only need to install JRE, if you want to develop a java application you need to install JDK and JRE. We're developing a java application so we need the JDK, Note we only need to install JDK because JRE is part of JDK so we don't need to download separate installer. Note that the installation procedure in this tutorial is for windows Operating System, The procedure that will be showed in this tutorial might not work on other OS, If your Operating System is MAC or linux check the MAC and linux installation procedure link in the description.

How to Install Oracle Java JDK 8

Let's Download JDK in the oracle website, link in the description, after that you will see two downloads the java Platform(JDK) and Netbeans with JDK 8, Netbeans is an Integrated Development Environment(IDE) which will be explained later so for now click the java platform(JDK) download button, go to java SE Development Kit 8u131, Accept license agreement and download the appropriate JDK package for your PC, mine is Windows 7 Ultimate 64 bit system so I'll choose Windows x64; I don't need to download JDK because I downloaded it already.

Once you downloaded JDK, Open it and when the installer pops up click next, on the next part there is an option where you can change the JDK install location, if you want to change the installation location click the change button, then click the drop-down arrow and just click on the location that you want, I don't want to change my installation location so i'll use the default installation folder, click OK if you're done, then click next and wait for the part to pop up, on the next part we will be installing the Java Runtime Environment(JRE) if you want to change the location where the JRE will be installed click the change button, if not click next, I'm ok with the default installation folder so I'll click next and wait for the installation to complete, When the installation is complete you can click the close button or click the next step button to redirect you to Java SE8 documentation and see the java conceptual diagram. 

One more thing, we need to register the JDK path to our system variables so that the cmd can recognize the javac and java commands, to do it go to my computer, then right click, select properties, click the environment variables button, look at the System variables list and select the path variable, click edit then type semicolon first if there is no semicolon at the end of the variable value then type the path or the location of your JDK in your system.After that open cmd and type "java -version" if the java version is shown on the cmd then Congratulations! You now have JDK and JRE installed on your PC! If not please retrack your steps.

How to install OpenJDK11 with OpenJ9 virtual machine on Windows 7

To install OpenJDK11 and OpenJ9 virtual machine, head over to this AdoptOpenJDK link, then choose a JVM version and a virtual machine, for JDK choose OpenJDK11(LTS), for virtual machine choose OpenJ9. After that, click the big blue button on the bottom and wait for it to finish downloading. After you have the files, extract it and you will receive this file: "jdk-11.0.1+13" . Once you successfully extracted the files, go to My Computer, right click it and then click "properties". After that, go to "Advanced System Settings" on the top-left corner  and go to "Environment Variables". Once you're in the "Environment Variables" go to the "System Variables" and select the "Path" and click "Edit..." on the bottom. After that, put the path where your files are located in the "Variable Value", I put mine in "C: Program Files/" and created a folder named "OpenJDK" there. Here is the example of my JDK and JRE path in my "Variable Value": C:\Program Files\OpenJDK\jdk-11.0.1+13\bin;

After that, open command prompt and type this command "java -version" and you will see this information. If you encountered a problem or error, try to redo the steps.

How to install OpenJDK17 on Windows x64

Go to https://adoptium.net/, choose OpenJDK17(LTS) and click the blue button below to download the Eclipse Temurin installer. For beginners, use the default settings in the installer. In other words, just follow the installer and don't change anything except for the installation folder. You may change the installation folder if you want.

Take note that some IDEs such as NetBeans 13, require a JAVA_HOME variable in our system. if you want to use Eclipse Temurin in NetBeans 13, go to the setup section, click on the left icon besides "Set JAVA_HOME variable" label and choose "Will be installed on local hard drive" option.

Brief Introduction to IDE(Integrated Development Environment)

let's talk about IDE's. IDE provides comprehensive facilities to computer programmers for the ease of software development, IDE makes the programmers work much easier because of the tools that they provide.If you're interested on IDE's I provided a list of java IDE that you can use to create java application. In this tutorial we will use the cmd(command line or windows terminal), Mac Terminal if you're using mac and linux terminal if you're using linux to compile our code.

So why we will not use IDE's even it has numerous advantage? Remember, this is a beginner tutorial so learning the basics is crucial, when we use an IDE like netbeans; it will do the compiling and execution for us and as we progressed on learning java using an IDE, we have no idea on how IDE compiles our project which is bad in some cases like if your professor or colleagues asked you to compile a java code without using an IDE you will be stumped and can't do anything. So don't always rely on the IDE. If you're doing some tedious projects like business related projects then IDE's are necessary in order to complete your project fast. Since we're in the learning process it is not necessary to use an IDE.

No comments:

Post a Comment