下载JDK 5

下载JDK 5

尝试安装 Java 1.5 JDK 时出现此错误

sudo apt-get install sun-java5-jdk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package sun-java5-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  apt:i386 apt

E: Package 'sun-java5-jdk' has no installation candidate

答案1

下载JDK 5

为JDK创建目录:

sudo mkdir /usr/lib/jvm/java5

在新文件夹中提取档案:

sudo tar xf java5.tar.gz -C /usr/lib/jvm/java5

现在运行:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java5/jdk1.5.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java5/jdk1.5.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/java5/jdk1.5.0/bin/javaws" 1

更正文件所有权和可执行文件的权限:

sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/java5/jdk1.5.0

检查是否成功:

java -version

相关内容