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

Ubuntu 16.04安装oracle-java6-installer报错,求Java6替代安装方案

Installing Oracle Java 6 on Ubuntu 16.04 (Alternative Workarounds)

Since Oracle has removed public download links for Java 6, the oracle-java6-installer package can no longer fetch the required binary automatically. Here are two practical methods to get Java 6 up and running for your legacy application:

Method 1: Manual Installation of Oracle Java 6

This method lets you use a local copy of the Java 6 binary (you’ll need to obtain this legally—check old backups or trusted archival sources for an unmodified jdk-6u45-linux-x64.bin file):

  1. Make the binary executable:
    Navigate to the directory where you saved the file in terminal, then run:
    chmod +x jdk-6u45-linux-x64.bin
    
  2. Extract the JDK files:
    Execute the binary to unpack the JDK:
    ./jdk-6u45-linux-x64.bin
    
    This will create a folder named jdk1.6.0_45.
  3. Move to a standard system location:
    Use sudo to place the JDK in the common Java directory:
    sudo mkdir -p /usr/lib/jvm
    sudo mv jdk1.6.0_45 /usr/lib/jvm/
    
  4. Register with system alternatives:
    Tell Ubuntu about this new Java installation:
    sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 100
    sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 100
    
  5. Set as default (optional):
    If you want Java 6 to be the system’s default, run:
    sudo update-alternatives --config java
    
    Then enter the number corresponding to /usr/lib/jvm/jdk1.6.0_45/bin/java.
  6. Verify the installation:
    Check if Java 6 is working:
    java -version
    
    You should see output like this:

    java version "1.6.0_45"
    Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

Method 2: Use OpenJDK 6 (If Your App Supports It)

Some legacy apps work with OpenJDK 6 instead of Oracle’s version. Since Ubuntu 16.04’s default repos don’t include it, you can temporarily enable older Ubuntu repos to install it:

  1. Add the trusty repository:
    sudo add-apt-repository "deb http://old-releases.ubuntu.com/ubuntu/ trusty main universe"
    
  2. Update package lists:
    sudo apt-get update
    
  3. Install OpenJDK 6:
    sudo apt-get install openjdk-6-jdk
    
  4. Register with system alternatives:
    Follow step 4 from Method 1 to set OpenJDK 6 as an option, and step 5 if you want it as default.
  5. Remove the old repo (recommended):
    To avoid conflicts with newer packages, disable the trusty repo after installation:
    sudo add-apt-repository --remove "deb http://old-releases.ubuntu.com/ubuntu/ trusty main universe"
    sudo apt-get update
    

Important Notes

  • Java 6 is no longer supported (no security updates), so use it only for your specific legacy app and keep it isolated from other systems if possible.
  • Always verify the integrity of any downloaded Java binary to avoid malware risks.

内容的提问来源于stack exchange,提问作者Manas Ranjan Mohapatra

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 11:35:03