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.)
sudo apt-get update && sudo apt-get upgrade
2. Download Oracle JDK 8 from the Official Website
- Go to this website: https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html
- Sign in with an Oracle account. If you don’t have one, you can create it (it’s free).
- Download the jdk-8u202-linux-x64.tar.gz file into your Downloads directory.
3. Extract and Install JDK
Create a directory under /opt and extract the archive there.
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:
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:
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:
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:
java -version
javac -version
echo $JAVA_HOME
You should see output similar to:
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

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:
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
Written by
DebuggerMe TeamThe DebuggerMe team builds developer tools, writes technical content, and helps teams ship better software.
Related Articles
All articles →Run Two Claude Code Accounts at Once (Personal + Office)
Claude Code has no account switcher yet, but one environment variable lets you keep a personal and an office login active at the same time. Here's the full setup.
React Server Components in Depth: What They Are and When to Use Them
React Server Components fundamentally change how we think about rendering. This guide breaks down how they work, how they differ from Client Components, and the patterns that will make your Next.js apps faster.
Getting Started with Next.js 16: A Complete Guide
Everything you need to know to build fast, modern web applications with Next.js 16 App Router, Server Components, and TypeScript. From project setup to production deployment.
