How to install java and javac on linux any version via easy step
We will install “jdk-19” . In the future if you install jdk-20 your command will stand for “jdk-20” instead , Are you understand?
Download site of java officials :
Download the Latest Java LTS Free
- Download with file .deb (x64 Debian Package)
- Go to download directory
- Select file and open with “Software Install”
- Click to Install via this program
- Go to terminal
- Tell terminal where package we are install
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-19/bin/java" 1- Set path
sudo update-alternatives --set java /usr/lib/jvm/jdk-19/bin/java- Verify what’s version we use
sudo update-alternatives --config javacheck your terminal know your java with
java --version- 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 --versionTo this you will complete set javac and java on linux!
After we install Step 4 my java package will store on path
/usr/lib/jvm/jdk-19if we go to this path we will see the bin directory
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










