Whether you want to start coding in Java or just run Java apps, the first thing you need to do is learn how to use Java to install. In this post we'll see how to do that.
Why do you need to install Java?
Programmers would describe Java as both "compiled" and "interpreted". This means that Java code cannot be understood natively by the computer, but must first be “compiled” into Java bytecode. This bytecode can then be executed by any device on which the "Java Virtual Machine" is installed. Alternatively, the code can be translated by software installed on your computer.
Suffice it to say that until you install Java, you will not be able to run any programs running in it. Since many of the apps we use every day are written in Java, this is a problem! It also means you'll need a slightly different installation depending on whether you want to run or build Java apps.
To develop or run Java applications, you must first install Java to function as an interpreter. For this you need the Java Development Kit or JDK. This means that your computer can read the code and then translate it into something it can understand.
If you only want to run ready-made Java apps on your computer, you only need the Java Runtime Environment or JRE installed.
See also: Python vs Java: which language should you learn and what are the differences?
How to Install Java JRE
Good news is that Java is very easy to install and use. Simply visit the official download site at Java.com and click Agree and Start Free Download. The website automatically recognizes which operating system you are on and provides the corresponding version via an executable file.
This process will automatically install Java on your computer if you follow the instructions. From there you can run Java apps. Easy!
In other cases, you may be prompted to install Java while installing another program that it relies on. Just follow the instructions again and you have installed the interpreter on your device.
There is also an automated "online installer" that uses "IFTW" (Install for the Web) and requires less input from the user. This is useful so that developers can ensure that users have Java installed. However, you may need to make some changes to your firewall to prevent it from blocking the installation!
How to Install Java JDK
If you want to develop in Java, whether you're building Android apps or doing something else, you'll need the JDK: Java Development Kit.
Nowadays, Android Studio comes with a special “OpenJDK” so you don't have to install it manually: just follow the usual procedure to install Android Studio.
Also read: How to Install Android Studio and Start Your First Project
However, you may need it for other development scenarios. If so, you can go to the Java SE Development Kit page on Oracle.com. Here you will find downloads for every major platform available for download.
Installing the JDK is again a simple matter by following the steps when prompted. The good news is that the JDK comes with the JRE so you don't have to install the two separately.
How to check the Java version
Once Java is installed on your computer, it starts up like your computer. You can see it running in the system tray. Move the mouse over it and when an update is due, the message "Java update available" will appear. Click the icon to start the update.
To check the version of Java installed on your computer, simply run the app that came with your main About Java installation. You can also find another one named "Check for Updates". Guess what that does!