Oracle Java包安装失败,Ubuntu 16.04添加PPA报错求助
Hey there, I’ve dealt with this exact problem before—let’s break down what’s happening and how to fix it quickly.
The error you’re seeing happens because the webupd8team/java PPA was officially deprecated a while back, and the associated Launchpad account/team has been removed. That means this PPA is no longer accessible, so we need to use alternative methods to get a working JDK on your Ubuntu 16.04 system.
Option 1: Install OpenJDK (Recommended)
OpenJDK is the open-source, officially supported alternative to Oracle JDK in Ubuntu’s repositories. It’s stable, maintained, and doesn’t require any third-party PPAs. Here’s how to set it up:
- First, update your package list to ensure you have the latest repository info:
sudo apt update - Install OpenJDK 8 (the most stable, widely supported version for Ubuntu 16.04):
sudo apt install openjdk-8-jdk - Verify the installation was successful by running these commands:
You should see output showing the OpenJDK version details.java -version javac -version - If you have multiple JDK versions installed and need to switch the default one, run:
Then select the number corresponding to the OpenJDK 8 entry.sudo update-alternatives --config java
Option 2: Manually Install Oracle JDK (If You Need the Oracle Version)
If you specifically require Oracle JDK (for compatibility with certain tools, for example), you’ll have to install it manually since the PPA is gone:
- Download the Oracle JDK 8 tarball from Oracle’s official site (note: newer Oracle JDK versions may require you to create/use an Oracle account to download).
- Create a directory to store the JDK files (if it doesn’t exist):
sudo mkdir -p /usr/lib/jvm/ - Extract the downloaded tarball into this directory (replace
jdk-8uXXX-linux-x64.tar.gzwith your actual filename):sudo tar -xvf jdk-8uXXX-linux-x64.tar.gz -C /usr/lib/jvm/ - Set up environment variables to make the JDK available system-wide. Edit your user’s bash profile with:
Add these lines at the end (replacenano ~/.bashrcjdk1.8.0_XXXwith the actual folder name from the extracted tarball):export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_XXX export PATH=$PATH:$JAVA_HOME/bin - Save and exit the editor (press
Ctrl+O, thenEnter, thenCtrl+X), then apply the changes:source ~/.bashrc - Verify the installation with:
You should see Oracle JDK’s version info if everything worked.java -version javac -version
Clean Up the Invalid PPA (If You Tried Adding It)
If you already attempted to add the broken PPA, it’s a good idea to remove it to avoid future update errors:
- List all your PPAs to find the broken one:
ls /etc/apt/sources.list.d/ - Delete the file associated with
webupd8team/java(it will look likewebupd8team-ubuntu-java*.list):sudo rm /etc/apt/sources.list.d/webupd8team-ubuntu-java*.list - Update your package list again to clear any invalid entries:
sudo apt update
内容的提问来源于stack exchange,提问作者Sparsh Dutta

