Skip to content
All posts
Tutorial3 min read

How to install Oracle JDK 8 on Deepin (Updated Method)

DebuggerMe TeamDebuggerMe TeamMay 15, 2025
How to install Oracle JDK 8 on Deepin (Updated Method)
On this page

This guide will introduce how to install Oracle JDK 8 (Java Development Kit) on your Deepin Linux. Oracle JDK 8 is still widely used for legacy Java applications, older Android build tooling, and internal enterprise systems that were never migrated off Java 8. Since the traditional webupd8team PPA is no longer available, you’ll need to install it manually. Here’s the correct and updated way to install Oracle JDK 8 on Deepin Linux.

1. Update Your System

Before installing anything, make sure your system is up to date by running the command below in your terminal. (To open the Terminal, search for “Terminal” in the app menu.)

code
sudo apt-get update && sudo apt-get upgrade

2. Download Oracle JDK 8 from the Official Website

3. Extract and Install JDK

Create a directory under /opt and extract the archive there.

code
sudo mkdir -p /opt/java
cd ~/Downloads
sudo tar -zxvf jdk-8u202-linux-x64.tar.gz -C /opt/java

This creates /opt/java/jdk1.8.0_202, containing the actual bin, lib, and include folders. That directory name, not the .tar.gz filename, is what the next step needs to point to.

4. Set Oracle JDK 8 as Default

Register the JDK with update-alternatives so the system knows where to find it:

code
sudo update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_202/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /opt/java/jdk1.8.0_202/bin/javac 1

Then select it as the default:

code
sudo update-alternatives --config java
sudo update-alternatives --config javac

When asked, type the number next to the Oracle JDK 8 entry and hit Enter.

5. Set JAVA_HOME

Most build tools (Maven, Gradle, Ant) look for a JAVA_HOME environment variable rather than relying on update-alternatives alone. Add it to your shell profile:

code
echo 'export JAVA_HOME=/opt/java/jdk1.8.0_202' >> ~/.bashrc
echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

If you use Zsh instead of Bash, append the same two lines to ~/.zshrc and run source ~/.zshrc instead.

6. Verify the Installation

Run the following commands to verify your JDK installation:

code
java -version
javac -version
echo $JAVA_HOME

You should see output similar to:

code
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
javac 1.8.0_202
/opt/java/jdk1.8.0_202

Terminal output of java -version showing Oracle JDK 8

If it shows something like the above, Oracle JDK 8 is installed and set as your default.

Troubleshooting

java: command not found after installation. Your shell hasn’t picked up the update-alternatives change. Open a new terminal window, or run hash -r in the current one.

java -version shows a different version than expected. You likely have another JDK installed (often OpenJDK, bundled with Deepin by default). Run sudo update-alternatives --config java again and pick the Oracle entry.

Permission denied when extracting to /opt. Make sure you’re using sudo on the tar command itself, not just mkdir. The /opt directory is owned by root on most Deepin installs.

Switching Back to OpenJDK

If a specific project needs OpenJDK instead, install it and switch with the same mechanism:

code
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java

update-alternatives will list every registered JDK, Oracle and OpenJDK included, so you can switch between them per project without reinstalling anything.

Tagged with

DebuggerMe Team

Written by

DebuggerMe Team

The DebuggerMe team builds developer tools, writes technical content, and helps teams ship better software.

Share this post

Back to all posts

Related Articles

All articles →