如何安装 Java 5 SDK 来构建 Android 源代码?
根据 Android Developer 网站,以下是安装 Java 5 SDK 的过程,
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper main multiverse"
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper-updates main multiverse"
$ sudo apt-get update
$ sudo apt-get install sun-java5-jdk
但是,当我尝试执行最后两个命令时,出现错误 - 原因是前两个命令添加到存储库的 URL 无法访问。 我使用的是 Ubuntu 11.04。 在这种情况下,我该如何执行Java 5 SDK?
如果我从 http://java.sun.com 安装 Java 5 SDK,那么我会收到错误 *make*ing Android 源
com.sun.javadoc 包不存在
请建议我一个合适的方法
According to Android Developer website, the following is the process to install Java 5 SDK
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper main multiverse"
$ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu dapper-updates main multiverse"
$ sudo apt-get update
$ sudo apt-get install sun-java5-jdk
But, when I try to execute the last two commands I get an error -- the reason being the URL added to the repository by the first two commands is inaccessible.
I am using Ubuntu 11.04.
In that case, how do I execute Java 5 SDK?
If I install Java 5 SDK from http://java.sun.com, then I get error while *make*ing Android Sources due to the following reason
package com.sun.javadoc does not exist
Please suggest me a suitable way
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试使用 Hardy 存储库。这适用于 Ubuntu 10.04 32 位。
运行确认是否安装成功。
要切换 Java 版本,请运行。
然后确认切换成功,运行。
You can try using the hardy repository. This works fine with Ubuntu 10.04 32bit.
To confirm if successfully installed run.
To switch the Java version, run.
Then confirm if switched successfully, run.
如果您从 Oracle 安装 Java 5 SDK(下载 .bin 是我的首选方法),完成后,您将需要 sudo 编辑您的 etc-alternatives 安装后配置。您可以通过命令“which java”或“which javaw”来判断您引用的是哪一个。
对于 Oracle JDK,可能是这样的:
如果您不使用“update-alternatives”,您可以在 /etc/alternatives/java 中手动执行此操作,至少,您将需要 sudo 访问权限来更新 java 符号链接,以便您路径中的 java 会转到正确的位置。当然,您还需要注意其他复杂情况。
因为我喜欢纯粹的 Oracle Java,所以我通常使用“Oracle Solaris 11 Express”作为我的 Java 开发的 Linux 发行版。
If you install the Java 5 SDK from Oracle (downloading the .bin is my preferred method), when you are done, you will need to sudo edit your etc-alternatives configuration after the installation. You can tell which one your referencing by the command "which java" or "which javaw".
For Oracle JDK, it might be something like:
If you don't use "update-alternatives", you can do it manually in /etc/alternatives/java, at minimum, you will need sudo access to update the java symbolic link so that the java in your path goes to the right location. Of course, there are other complications to this that you need to watch out for.
Because I like to be pure Oracle Java, I usually use "Oracle Solaris 11 Express" as my linux distro for java development.
11.04 被称为“natty narwhal”; dapper 是不久前的作品。 java 5 也确实很老了。你现在应该使用java 6或7。
11.04 is called natty narwhal; dapper is from a while ago. java 5 is really old too. you should be using java 6 or 7 now.