Android编译需要安装sun-jdk,但新版本的Ubuntu已经在atp源中删除了了sun-jdk,可以添加老版本的apt源,或者手动安装jdk,步骤如下:
修改自:
JDK (Java Development Kit) is a software that provides development tools for creating Java programs.
Installation
First we must download the package from the java website, select your platform, in our case Linux:
Here we go down the file "jdk-6u21-linux-x64.bin" to any folder, then leave where appropriate.
Now we have to give execute permissions:
sudo chmod +x jdk-6u29-linux-x64.bin
and install:
sudo ./jdk-6u29-linux-x64.bin
Now move the generated folder to a more appropriate directory:
sudo mv jdk1.6.0_29/ /usr/local
We set the new Java as one of the alternatives "java"
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/jdk1.6.0_29/bin/java" 1
Now we set the "new alternative" as real Java. This step makes the sun is the version used by default:
sudo update-alternatives --set java /usr/local/jdk1.6.0_29/bin/java
Now we do the same steps above for javac:
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/jdk1.6.0_29/bin/javac" 1
sudo update-alternatives --set javac /usr/local/jdk1.6.0_29/bin/javac
for jar:
sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/local/jdk1.6.0_29/bin/jar" 1
sudo update-alternatives --set jar /usr/local/jdk1.6.0_29/bin/jar
for javah:
sudo update-alternatives --install "/usr/bin/javah" "javah" "/usr/local/jdk1.6.0_29/bin/javah" 1
sudo update-alternatives --set javah /usr/local/jdk1.6.0_29/bin/javah
for javadoc
sudo update-alternatives --install "/usr/bin/javadoc" "javadoc" "/usr/local/jdk1.6.0_29/bin/javadoc" 1
sudo update-alternatives --set javadoc /usr/local/jdk1.6.0_29/bin/javadoc
Now verify that everything works properly. Open the console and type:
java -version
If all is well, you should return the following:
java version "1.6.0_29"
Java (TM) SE Runtime Environment (build 1.6.0_29-B06)
Java HotSpot (TM) Client VM (build 17.0-b16, mixed mode, sharing)
For javac:
javac -version
If all is well back:
javac 1.6.0_29
If you have other installations of java / javac can be configured using the following commands:
sudo update-alternatives --config java
sudo update-alternatives --config javac
Also if you want setear JRE_HOME JAVA_HOME or as environment variables, we must go to:
sudo gedit /etc/environment
Here we record the routes where we have installed Java, in our case is as follows:
JAVA_HOME = "/usr/local/jdk1.6.0_29/bin/" (add)
JRE_HOME = "/usr/local/jdk1.6.0_29/jre" (add)
PATH ="...(other routes):$JAVA_HOME:$JRE_HOME (edit)
With this we finish the installation.
阅读(2371) | 评论(0) | 转发(0) |