You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Oracle Java包安装失败,Ubuntu 16.04添加PPA报错求助

Fixing the "Cannot add PPA: 'ppa:~webupd8team/ubuntu/java'" Error on Ubuntu 16.04

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.

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:
    java -version
    javac -version
    
    You should see output showing the OpenJDK version details.
  • If you have multiple JDK versions installed and need to switch the default one, run:
    sudo update-alternatives --config java
    
    Then select the number corresponding to the OpenJDK 8 entry.

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:

  1. 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).
  2. Create a directory to store the JDK files (if it doesn’t exist):
    sudo mkdir -p /usr/lib/jvm/
    
  3. Extract the downloaded tarball into this directory (replace jdk-8uXXX-linux-x64.tar.gz with your actual filename):
    sudo tar -xvf jdk-8uXXX-linux-x64.tar.gz -C /usr/lib/jvm/
    
  4. Set up environment variables to make the JDK available system-wide. Edit your user’s bash profile with:
    nano ~/.bashrc
    
    Add these lines at the end (replace jdk1.8.0_XXX with the actual folder name from the extracted tarball):
    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_XXX
    export PATH=$PATH:$JAVA_HOME/bin
    
  5. Save and exit the editor (press Ctrl+O, then Enter, then Ctrl+X), then apply the changes:
    source ~/.bashrc
    
  6. Verify the installation with:
    java -version
    javac -version
    
    You should see Oracle JDK’s version info if everything worked.

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 like webupd8team-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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:45:58