Get started with Java

Naman GargNaman Garg
3 min read

Java is a popular programming language, created in 1995. It is owned by Oracle, and more than 3 billion devices run Java.

It is used for:

  • Mobile applications (especially Android apps)

  • Desktop applications

  • Web applications

  • Web servers and application servers

  • Games

  • Database connection

  • And much, much more!

Why Use Java?

  • Java works on different platforms (Windows, Mac, Linux, etc.).

  • It has a large demand in the current job market.

  • It is easy to learn and simple to use.

  • It is open-source and free.

  • It is secure, fast and powerful.

  • Java is an object-oriented language that allows code to be reused, lowering development costs.

Installing Java

Some PCs might have Java already installed.

To check if you have Java installed on a Windows PC, search in the start bar for Java or type the following in Command Prompt (cmd.exe):

C:\Users\Your Name>java -version

If Java is installed, you will see something like this (depending on version):

java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

If you do not have Java installed on your computer, you can download it for free at oracle.com.

To check on Mac, search in the terminal by writing the following prompt:

java -version

If Java is already installed on your system it will tell the version of Java.

To install Java on Windows:

  1. Go to "System Properties" (Can be found on Control Panel > System and Security > System > Advanced System Settings).

  2. Click on the "Environment variables" button under the "Advanced" tab.

  3. Then, select the "Path" variable in System variables and click on the "Edit" button.

  4. Click on the "New" button and add the path where Java is installed, followed by \bin. By default, Java is installed in C:\Program Files\Java\jdk-11.0.1 (If nothing else was specified when you installed it). In that case, You will have to add a new path with: C:\Program Files\Java\jdk-11.0.1\bin
    Then, click "OK", and save the settings.

  5. At last, open Command Prompt (cmd.exe) and type java -version to see if Java is running on your machine.

To install Java on Mac:

  1. Go to "oracle java installation website".

  2. Download Java 21 x64 DMG Installer by clicking on the download link and carry on with the download procedure.

  3. Open the DMG file -> double-click the JDK package to download in the previous step to start installing Oracle JDK 21 on your Mac. It will install the DMG disk and present the installer. Go through the updated License Agreement of Oracle JDK.

  4. Click the Continue button -> select destination -> install -> Enter your password to give permission to install Java 21.

  5. Now unmount the DMG image by right-clicking it basically we are deleting the setup just unlikely we do in Windows.

1
Subscribe to my newsletter

Read articles from Naman Garg directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Naman Garg
Naman Garg