DEV Community

Cover image for Getting Started with Java - Installation
Raj Pansuriya
Raj Pansuriya

Posted on • Originally published at learn-in-public.hashnode.dev

Getting Started with Java - Installation

You can install the latest version of java for Windows and macOS from its official site. For Linux-based distributions command line is the recommended option. Follow the instructions:

  • Install java for MacOS
  • Install java for Windows
  • Install java for linux Note: Though you can download and install JDK for Linux from the official site, I would highly recommend you to use the official package manager for your distribution.

Java on Linux distributions

  • Ubuntu, Debian, and distributions that use apt as the package manager
    Open your terminal and follow the guide

    Update the package index

    $ sudo apt-get update
    

    Check if Java is not already installed:

    $ java --version
    

    If Java is already installed we'll get output similar to below

    openjdk 17.0.1 2021-10-19
    OpenJDK Runtime Environment (build 17.0.1+12)
    OpenJDK 64-Bit Server VM (build 17.0.1+12, mixed mode)
    

    If not, then install java

    $ sudo apt-get install default-jdk
    
  • For arch and arch-based distributions

    Update the system

    $ sudo pacman -Syyu
    

    Check if Java is not already installed:

    $ java --version
    

    Search for available JRE in the arch repository

    $ pacman -Ss java | grep jre
    

    image.png
    Install the latest jre

    $ sudo pacman -S jre-openjdk
    

    Similarly, search for the latest JDK and install it

    $ pacman -Ss java | grep jdk
    

    image.png

    $ sudo pacman -S jdk-openjdk
    

The next thing you may want to install is an Integrated Development Environment (IDE). There are so many IDE's available for Java development. One of the best being IntelliJ IDEA. You may even consider setting a Java Development Environment in your preferred text editor such as VSCode or Atom, etc. I leave these things to your liking.

That's all for this one. Feel free to connect with me
Twitter logo

LinkedIn Badge

Discussion (0)