在安装android on openwrt是出现错误:
build/core/config.mk:271:
*** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com. Stop.
一 第一种方法:
输入下面的命令
sudo apt-get install sun-java6-jdk
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo add-apt-repository "deb http://archive.canonical.com/ubuntu maverick partner"
deb http://archive.canonical.com/ lucid partner
deb http://archive.canonical.com/ubuntu maverick partner
sudo apt-get update
sudo apt-get install sun-java6-jdk
二 手动安装
如果上面方法不行,则要下载手动安装jdk6,下载地址:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html
http://download.oracle.com/otn/java/jdk/6/jdk-6-linux-i586.bin
jdk5下载地址:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html
http://download.oracle.com/otn/java/jdk/1.5.0_22/jdk-1_5_0_22-linux-i586.bin
下面以安装jdk6为例,如果安装的是jdk5,步骤相同。
首先,从http://java.sun.com中下载jdk,我的版本是jdk-6-linux-i586.bin,我下载的是bin文件,我将下载的jdk-6-linux-i586.bin文件置于/usr/lib/jvm/java中。
然后修改bin文件权限,使其可执行,在shell中执行:
sudo chmod u+x /usr/lib/jvm/java/jdk-6-linux-i586.bin
sudo /usr/lib/jvm/java/jdk-6-linux-i586.bin
此时,jdk已安装完毕。
sudo vi /etc/environment
PATH="......:/usr/lib/jvm/java/jdk1.6.0/bin"
CLASSPATH=.:/usr/lib/jvm/java/jdk1.6.0/lib
JAVA_HOME=/usr/lib/jvm/java/jdk1.6.0
或者直接在/etc/profile中添加:(推荐使用)
sudo vi /etc/profile
#JAVAEVIRENMENT
export JAVA_HOME=/usr/lib/jvm/java/jdk1.6.0_34
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
sudo source ~/.bashrc
通过这一步将我们安装的jdk加入java选单,执行:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java/jdk1.6.0/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java/jdk1.6.0/bin/javac 300
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/java/jdk1.6.0/bin/javah 300
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javah
java -version
参考:
http://forum.ubuntu.org.cn/viewtopic.php?t=183803