If you run the following command to install the SDK, enter:
// We recommend that you use open-JDK instead of sun-JDK. If you need to install sun-JDK, you should enter: sudo apt-Get install sun-java6-jdk on the terminal.
sudo apt-get install open-jdk6-jdk
If the binfile for JDK installation is
1. Download The binfile
2.Chmod U + x jdk-6u32-linux-x64.bin// Modify the permission to Executable
3./Jdk-6u32-linux-x64.bin// Install./Indicates executing the binfile
4. modify the configuration file sudo gedit ~ /. Add bashrc to path. // You can also modify the/etc/profile file.
For example, my configuration: the configuration location of the android SDK can be ignored.
export ANDROID_SDK=~/fql_zlyy/android-sdkexport APK_HOME=~/fql_zlyy/tools/apktool-install-linux-r04-brut1export PATH=$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools:$JAVA_HOME/bin:$PATHexport PATH=$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$APK_HOME$PATHexport CLASSPATH=$ANDROID_SDK/platform-tools/lib:$ANDROID_SDK/tools/lib:$JAVA_HOME/lib:$CLASSPATHexport JAVA_HOME=~/fql_zlyy/tools/jdk1.6.0_32export JRE_HOME=~/fql_zlyy/tools/jdk1.6.0_32/jre
5. If JDK has been installed on the computer, for example, JDK 1.7 I installed earlier, but now the android source code compilation requires JDK 1.6, the following configuration is required:
Add the JDK we installed to the Java menu:
sudo update-alternatives --install /usr/bin/java java /home/fql/fql_zlyy/tools/jdk1.6.0_32/bin/java 300sudo update-alternatives --install /usr/bin/javac javac /home/fql/fql_zlyy/tools/jdk1.6.0_32/bin/javac 300
6. Set the new JDK to the default one.
Run the following command:
Sudo Update-alternatives -- config Java // select the default JDK
For example, my environment was like this:
Fql @ fql-system-product-Name :~ /Fql_zlyy/tools $ sudo Update-alternatives -- config Java has two candidates for replacing Java (/usr/bin/Java ). Select the path priority status defaults 0/home/fql/fql_zlyy/tools/jdk1.6.0 _ 32/bin/Java 300 automatic mode 1/home/fql/fql_zlyy/tools/jdk1.6.0 _ 32/bin /Java 300 manual mode * 2/usr/lib/JVM/Java-7-Oracle/JRE/bin/Java 2 manual mode to maintain the current value [*] Press enter, or enter the selected number:1
7. After the selection is successful, you can
Java-version // view the current JDK version fql @ fql-system-product-Name :~ /Fql_zlyy/toolsjava-versionjava version "1.6.0 _ 32" Java (TM) se Runtime Environment (build 1.6.0 _ 32-b05) Java hotspot (TM) 64-bit server VM (build route 7-b02, mixed Mode) when "1.6.0 _ 32" is displayed, it indicates that the installation is successful, but after the installation, the android source code compilation always prompts that the jar error is not found: solution: sudo Update-alternatives -- install "/usr/bin/jar" "jar" "/home/fql/fql_zlyy/tools/jdk1.6.0 _ 32/bin/jar" 300 references: why is jar not found after JDK is installed in this way, there is always a problem when compiling the android source code. Therefore, we recommend that you install Install the modified configuration file in the/usr/lib/JVM/directory: Export android_sdk = ~ /Fql_zlyy/Android-SDK # export java_home = ~ /Fql_zlyy/tools/jdk1.6.0 _ 32 Export java_home =/usr/lib/JVM/Java-6-sun # export jre_home = ~ /Fql_zlyy/tools/jdk1.6.0 _ 32/jreexport apk_home = ~ /Fql_zlyy/tools/apktool-install-linux-r04-brut1export Path = $ android_sdk/platform-tools: $ android_sdk/tools: $ java_home/bin: $ pathexport Path = $ android_sdk/tools: $ android_sdk/platform-tools: $ apk_home: $ pathexport classpath = $ android_sdk/platform-tools/lib: $ android_sdk/tools/lib: $ java_home/lib: $ classpath