One of the things you need to do in order to program in Java is install the Java development kit,
also known as the JDK and that's actually what we're going to do in this video.
We're going to install the JDK version 11 on the Linux platform.
You know if you're running on a Windows machine or a Mac machine there are separate videos for that
but if you're on a Linux machine, you're in the right place. Let's get started.
So at this point now, it's time to download and install the
Java Development Kit. We're going to be
using version 11 as we've discussed previously. So I'm going to go firstly to
the Java website and that is java.sun.com and we're going to download the Java development kit
so once we arrive at the site I'm just going to size this up so you can see it
click on Java SE and SE by the way stands for Java standard edition and you
can see over here we've got Java SE 11 LTS, LTS stands for long term support and
we want to come down over here to the right hand side under Oracle JDK and I'm going
to click on download that brings us to this page which is where we can download
the JDK I need to click on it accept license agreement now because I'm on
Ubuntu Linux I'm going to download and install the tar.gz file and that
will probably work with most distros but if you want to depending whether you've
got Red Hat or Debian or some other distro of Linux you can download one of
these other images so I'm going to select the tar.gz and gonna
save that to my downloads folder and we'll give that a moment to complete now
the process is going to be a little bit different because we are on Linux we're
going to basically move it over manually ourselves into the relevant folder so to
do that what I'm going to do is go into the command line for this I'm going to
wait for this download to finish and then we'll make a start on it, well actually
may as well open the terminal window now while that's still downloading, so I'm
gonna come up here to activities I'm going to open terminal,so gonna type
terminal in here but you can just open that the terminal in the
normal way the way you would normally open it again I'll just size this up
once this is finished downloading so we can see what we're doing I'll just pause
now until this is finished downloading okay so you can see that's now
downloaded I'm just going to minimize the browser for now and bring back our
terminal window which i've opened and I'm going to come into the Downloads
folder cd space ~/downloads with a capital D and if we do a LS we
should be able to see our JDK file there and what we want to do now is we want to
unzip it first I'm going to use tar for that so I'm gonna make this a bit bigger
so you can see the commands I'm typing here so I'm going to type tar space -
xvf space and i'm going to type jdk and press tab and choose our version of
the gz file and press Enter and you can see that's unzipped it
the file there now if we have a look again we can see we've got a JDK 11 folder in
the bottom left-hand corner there so the next thing we want to do is create a
directory to store our Java development kit I'm going to put it in usr lib
jvm in a subfolder and the advantage of doing that is when we come to install
IntelliJ in the next video it looks there by default for that for the JDK
and it'll find it for us automatically so I'm going to start by typing sudo
you'll need to do that because we're trying to access files that have been a
creative by root so sudo space mkdir space - P and it's /usr/lib/jvm forward
slash and i'm just going to create a new directory and call it jdk-11 now if
there's a new version of the JDK there's a subversion that's come out
11.01 you might want to change the directory name to be that but I'm
just going to stick with jdk-11 and put a forward slash there alright that's
our folder created once I enter my password next I want to then move the
contents of our unzipped JDK into that folder so gonna type sudo space mv space
and jdk and I'm just pressing the tab there / and then * so
basically the contents of the JDK 11 folder that we've unzipped we want to
move the contents to /usr/lib /jvm/ gonna press tab
there because that's the only folder or the only directory in there JDK 11
and I'm gonna press enter and that's the contents now moved and just to make sure
we can type ls space /usr/lib /jvm/jdk-11/ and you can see the
files there now we can see a number of our folders their now depending on
whether you've got Java or the Java compiler configured we can actually use
the pseudo update alternatives command to set it up so that Java will work on
the command line at the moment if I type Java space -version will get the fact
that it's not found so if you're happy with that and you were only going to be
using Java from the IntelliJ IDEA the tool that we're going to be installing
in the next video you won't need to do this the command that I'm about to show
you but if you then actually want to run Java from the command line
I suggest you type this command in so go type sudo space update
space alternatives space - - or - - that should be install space and in double
quotes /usr/bin /java double quotes and a space
and then double quotes again the word Java in between and then we're going to
point to Java on our installation so that's gonna be double quotes
/usr/lib/jvm/jdk-11 /bin and /java and
closing double quotes space then 10 10 and now we can type Java space -version
we can see we've got now Java 11 actually working so I'm going to do the same for
the Java compiler so I'm just gonna press the up arrow twice and change java
to java c here and go back change java to java c there and then the final one
third place java c there as well so we've done the same for Java C as you
can see there alright now the other thing we could do we could spend time
setting up environment variables for Java we don't need to use that or do
that rather because we're going to be using the IntelliJ IDEA tool for
programming in Java so for that reason I'm not gonna spend anymore time
configuring I'm just going to close down terminal window typing exit and we'll finish the
video here in the next video we'll actually move on and start installing
the tool IntelliJ IDEA that we're going to be using to write our Java programs
so I'll see you in the next video