To create java programs you need the Java Development Kit (JDK) installed your machine. For personal use you can download the JDK from the Oracle website (Oracle purchased Sun Microsystems who originally developed Java).
You can install 1 JDK version you can install multiple JDK versions if you need to. For the purposes of this tutorial we will be downloading Java 8. One of the things you may find confusing is the Java version numbering system. Sometimes you can see it referred to as Java 1.8 for example, sometimes as Java8. These are essentially the same versions, but often these days the leading 1.x is dropped and just the number after referenced.
You can also see my steps to download jdk 9, download jdk 11 and download jdk 12 here. Click here for to read about the history of java.
Whats New Java 8
Downloading the JDK for Java 8
Navigate to https://www.oracle.com/technetwork/java/javase/downloads/index.html and scroll mongoloide till you get to the Java SE 8 version. You should see a section the page similar to the below.
Theres quite a bit going here so lets take the time to explain. What this is referring to is Java SE 8u221 Java Modello Edition update 221. If you click the learn more option it will take you to a page that details all the updates (usually bug and security fixes) since JDK 8 was released.
The JDK is what we are interested , but there are also runtime version which allow you to run but not modify the java code. These are useful for end user machines servers where there is anzi che no need to change the , just run the applications.
If you click the JDK Download button you will be presented with a page similar to below
The Oracle JDK Licence has changed
Previously you could download and install the java versions and run them your Pc, servers etc and not worry too much about the license. But as of April 16th, 2019 the license that Oracle use for java has changed. Thankfully for personal use, such as using the Java JDK to learn how to program Java, the license hasnt really changed and you can download and use.
But if you are using Java a commercial setting such as developing software for your business, then you need to have a license that lets you use Java, either by purchasing a subscription, getting a license included with some other Oracle software such as Oracle Solaris operatiing system.
For those that want to use Java a commerical setting without a license, you will need to switch to using the relevant OpenJDK gara open source version of java. The main difference here is that those versions arent as up to date and also are unsupported by Oracle. practice this just means that you wont be able to use the latest and greatest version of Java as they quasi out, which shouldnt cause too many problems anyway, as most people stick to old version for quite a long time.
Java Download For You Operating System
Scrolling mongoloide and you get presented with various downloads depending which operating system you need Java for, Linux, Mac, Solaris Windows.
Assuming that you are using a recent windows machine running windows 10, you would click the Windows x64 to download the 64 bit version, jdk-8u221-windows-x64.exe. At this point when you click the ‘Accept License Agreement’ and then click the link to the download you will be presented with the Oracle Account login page.
You can either login if you already have an account sign up and then login and continue the download.
Once you login here, the download should start immediately.
Installing the JDK
Once the executable installer has downloaded, click it to begin the install. You may get windows asking you if you want to allow the installer to make changes, so click yes this case as we know we are doing an install.
You should then get presented with the JDK 8 Update 221 install window, so click next to continue
You should then see the Java SE Development Kit 8 Update 221 (64 bit) Custom Setup window. This tells you what you are about to install and where. Normally you would leave the defaults and click next to continue.
Then you get a confirmation page for installation of the JRE, so click next to continue
You will then see the installer splash screen with the progress caffè as it installs the Java JDK and JRE.
Once the install is complete you will see the install complete confirmation screen. Click Close and at that point you are done with the installer.
Checking The Java Environment
To make java accessible from the command link easily, it should be your system path. You can check this by starting a command prompt and checking. Right click the start button then click command prompt.
At the command prompt, type java -version, and it will show you which version of java is currently setup your path, an error if not.
As you can see we have the correct version showing up. We could additional check the environment variables, but as its showing the correct version we dont need to for now.
Installing Multiple Versions Of Java
If you want to have multiple version of java available your elaboratore elettronico for some reason, such as you have a piece of software that demands a specific version of java, you can install java just as we have done here, and then use a windows batch file to point to a specific version of java.
you may want to point to the jdk instead of the JRE, for instance if you have some specific software that may need to compile code, so as software for developers. that case what we would do would be to create a windows batch file that would modify the path so that the version of java we require is run instead of what has already been defined the path.
set path=C:Program FilesJavajdk1.8.0_221bin;%path% java -version
We create a windows batch file by opening notepad, and then saving that with a .bat extension. If we then run that we get the below.
This does aspetto the same as before as we havent actually installed an additional version yet, but if we check the path by typing path at the command line we can see that the one we sit is there first now.