解决update-alternatives: error: no alternatives for mozilla-javaplugin.so.

来源:互联网 发布:极限挑战网络更新时间 编辑:程序博客网 时间:2024/05/16 14:33
 在32位Ubuntu10.04上编译Android2.3
本人在Ubuntu10.04系统 32位机上安装编译Android2.3源码,其步骤和注意事项如下:

1.安装JDK6
对于Android2.3系统,不要安装JDK5,应该安装最新的JDK6。
如果安装了JDK6,Android会自动按64位编译,如果系统是32位的,会有编译错误,后面会说如何修改这个错误。
apt-get install sun-java6-jdk

报错:
root@meie:~# apt-get install sun-java6-jdk
E: Malformed line 13 in source list /etc/apt/sources.list (dist parse)
E: The list of sources could not be read.
注释/etc/apt/sources.list中
#deb http://archive.canonical.com/lucid partner
#deb http://archive.canonical.com/ lucid partner
虽然Android官方网站上讲不支持Java 6,不过我使用Java 6也可以编译通过,所以在这里Easwy安装的是Java 6。去掉/etc/apt/sources.list中这两行的注释



报错:
Package sun-java6-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
E: Package sun-java6-jdk has no installation candidate
解决:添加一个源
add-apt-repository "deb http://archive.canonical.com/ lucid partner"
apt-get update
然后再 apt-get install sun-java6-jdk

接着:
update-java-alternatives -s java-6-sun

报错:

update-alternatives: error: no alternatives for mozilla-javaplugin.so.
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so.
update-alternatives: error: no alternatives for mozilla-javaplugin.so.
update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so.
解决:apt-get install sun-java6-plugin

然后再update-java-alternatives -s java-6-sun



安装完后,需要手动设置JAVA_HOME, JRE_HOME, CLASS_PATH为JDK6的安装路径。

export JAVA_HOME=/usr/lib/jvm/java-6-sun
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
export JRE_HOME=$JAVA_HOME/jre




2. 安装各种包
$ sudo aptitude install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

3. 安装Repo
$ mkdir ~/bin
$ export PATH=~/bin:$PATH
$ curl http://android.git.kernel.org/repo > ~/bin/repo
$ chmod a+x ~/bin/repo