Skip to content

zergreen/install-java-on-linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Install java on linux

Description 💬

How to install java and javac on linux any version via easy step

Disclaimer ⚠️

We will install “jdk-19” . In the future if you install jdk-20 your command will stand for “jdk-20” instead , Are you understand?

Dependency ✋

Download site of java officials :

Download the Latest Java LTS Free

Download & Install 🛠️

  1. Download with file .deb (x64 Debian Package)

Untitled

  1. Go to download directory

Untitled

  1. Select file and open with “Software Install”

Untitled

  1. Click to Install via this program

Untitled

  1. Go to terminal

Untitled

  1. Tell terminal where package we are install
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-19/bin/java" 1

Untitled

  1. Set path
sudo update-alternatives --set java /usr/lib/jvm/jdk-19/bin/java

Untitled

  1. Verify what’s version we use
sudo update-alternatives --config java

Untitled

check your terminal know your java with

java --version

Untitled

💡 We will do step 6 to step 8 again for setting javac path
  1. For javac we will do again with this below command
# step 6 : tell terminal where are javac install
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk-19/bin/javac" 1

# step 7 : set path 
sudo update-alternatives --set javac /usr/lib/jvm/jdk-19/bin/javac

# step 8 : check version we use
sudo update-alternatives --config javac

# check version :
javac --version

To this you will complete set javac and java on linux!

Tips 🧐

After we install Step 4 my java package will store on path

/usr/lib/jvm/jdk-19

Untitled

if we go to this path we will see the bin directory

Untitled

And lastly you will see javac and java on this path. Then we will set path on this OKAY!?

java => /usr/lib/jvm/jdk-19/bin/java
javac => /usr/lib/jvm/jdk-19/bin/javac

Untitled

Author ✍️

zergreen - Overview

About

how to install java on linux any version

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published