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

Ubuntu机器安装Oracle Java 8失败,请求技术帮助

Fixing Oracle JDK 8 Installer Download Failures on Ubuntu

Hey there, I’ve dealt with this exact problem before—Oracle tightened up their download policies a while back, which breaks the automated oracle-jdk8-installer package since it can’t handle the required login and license agreement. Let’s get this sorted out:

Option 1: Manually Cache the Required JDK Package

This lets the installer use your pre-downloaded file instead of trying to fetch it from Oracle’s servers:

  • First, clean up any partial or failed installation remnants:
    sudo apt-get purge oracle-jdk8-installer
    sudo apt-get autoremove && sudo apt-get clean
    
  • Go to Oracle’s official JDK 8 archive page, accept the license agreement, and download the 64-bit Linux tar.gz file matching the version your installer was targeting—for your case, that’s jdk-8u161-linux-x64.tar.gz.
  • Copy the downloaded file to the installer’s cache directory:
    sudo cp ~/Downloads/jdk-8u161-linux-x64.tar.gz /var/cache/oracle-jdk8-installer/
    
  • Re-run the installation command:
    sudo apt-get install oracle-jdk8-installer
    

The installer will now pick up the cached file instead of attempting to download it, bypassing the authentication block that was causing the issue.

Oracle JDK 8 has restricted public downloads now, so OpenJDK 8 is a fully functional, open-source alternative that’s far easier to install and maintain:

  • Install OpenJDK 8 and its development kit:
    sudo apt-get install openjdk-8-jdk
    
  • If you have multiple Java versions installed, set OpenJDK 8 as your default:
    sudo update-alternatives --config java
    sudo update-alternatives --config javac
    

Just select the OpenJDK 8 option from the menu that appears.

Why the Original Command Failed

Oracle now requires users to log in and accept their license agreement to download older JDK versions like 8u161. The oracle-jdk8-installer package wasn’t updated to handle this authentication step, so it gets stuck mid-download when trying to access the file without proper credentials.

内容的提问来源于stack exchange,提问作者Nipun

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 03:32:59