降级从OpenJDK 8到OpenJDK 6

我使用的是Ubuntu 16.04(32位)操作系统。 我安装了openjdk版本为"1.8.0_121"。
在编译文件时,我遇到了一个错误。
You are attempting to build with the incorrect version
of java.

Your version is: openjdk version "1.8.0_121".
The correct version is: Java SE 1.6.

我已经尝试过

sudo apt-get install openjdk-6-jdk

返回
openjdk-6-jdk has no installation candidate

尝试访问http://www.oracle.com/technetwork/java/javase/archive-139210.html,但由于多个错误无法安装。
因为出现了多个错误,所以无法安装。
Unpacking...
Checksumming...
Extracting...
./jdk-6u45-linux-i586-rpm.bin: 144: ./jdk-6u45-linux-i586-rpm.bin: ./install.sfx.17173: not found
Installing JavaDB
rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing...
error: open of sun-javadb-common-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-core-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-client-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-demo-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-docs-10.6.2-1.1.i386.rpm failed: No such file or directory
error: open of sun-javadb-javadoc-10.6.2-1.1.i386.rpm failed: No such file or directory

Done.

还尝试了来自http://www.oracle.com/technetwork/java/javase/archive-139210.html的非rpm版本,并获得了以下结果:
Unpacking...
Checksumming...
Extracting...
./jdk-6u45-linux-i586.bin: 74: ./jdk-6u45-linux-i586.bin: ./install.sfx.17296: not found
Failed to extract the files.  Please refer to the Troubleshooting section of
the Installation Instructions on the download page for more information.

我在某个地方找到了 openjdk-6_6b38-1.13.10.orig.tar.gz 忘记了我从哪里得到它,但是它抱怨我没有 JDK 主目录。

configure: error: "A JDK home directory could not be found."

我只是在深入挖掘,但一切都不起作用。 想知道是否有一些简单的存储库可以获取实际可用的openjdk-6-jdk?

谢谢!


当您从Oracle下载时,它看起来像您下载了rpm版本。 您应该尝试下载另一个版本 " jdk-6u45-linux-i586.bin" 以在Ubuntu上使用。 - gsxruk
也试过了,编辑了帖子来展示结果。但是那样也没有成功。 - pottedmeat7
你是在x64系统上安装吗?如果是的话,可以尝试这个帖子中的解决方法。可能需要使用sudo apt-get install lib32z1命令来安装32位库。 - gsxruk
编辑过的。我使用的是32位操作系统。 - pottedmeat7
安装了lib32z1后,我成功运行了./jdk-6u45-linux-i586.bin。我按照这篇帖子http://askubuntu.com/questions/67909/how-do-i-install-oracle-jdk-6 将提取的文件移动到了/usr/lib/jvm目录下,但是脚本http://webupd8.googlecode.com/files/update-java-0.5b却显示404错误。我仍然没有一个有效的Java安装... java -version命令无法工作。帖子中的脚本也无法使用。 - pottedmeat7
你需要将它设置为默认选项。此帖子中的问题提供了一个实际可行的示例。 - gsxruk
2个回答

OpenJDK 6仍然存在于Ubuntu Trusty中。

http://packages.ubuntu.com/search?keywords=openjdk

如果你有一台性能相对较强的电脑,你可以考虑使用Qemu/KVM或VirtualBox,在其中安装Ubuntu Trusty (14.04)作为虚拟机。 在我看来,这将是最干净的解决方案。
此外,还有一个针对OpenJDK 6的ppa,通过编辑下载的源列表文件(将xenial改为trusty),可能会在你的Xenial安装中起作用。

https://launchpad.net/ubuntu/+source/openjdk-6

在后一种情况下,我建议先移除OpenJDK-8。