下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jdk6u35-downloads-1836443.html
下载的是: jdk-6u35-linux-x64.bin (64位的)
2、改变权限 chmod u+x jdk-6u35-linux-i586.bin
3、解压 ./jdk-6u35-linux-x64.bin 解压出来目录是 jdk1.6.0_35
4、为JDK新建存放目录 sudo mkdir -p /usr/lib/jvm/
5、将解压出来的 jdk1.6.0_35 目录拷贝到新目录 sudo cp -r jdk1.6.0_35/ /usr/lib/jvm/jdk1.6.0_35/
6、配置环境变量:
$ sudo gedit /etc/profile
在文件的末尾加上如下内容,保存并关闭文件
# for java
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_35
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:$PATH
7、使设置生效:到此部JDK的配置就都完成了
$ source /etc/profile
8、测试
java -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)
9、至此完成JDK在ubuntu 14.04 64位上JDK1.6的安装
Ubuntu系统默认安装并使用OpenJDK(usr/lib/jvm/),因此需要手动修改系统默认的JDK,
sudo update-alternatives --install /usr/bin/javac javac /home/your_name/Tools/jdk1.7.0_51/bin/javac 300
sudo update-alternatives --install /usr/bin/java java /home/your_name/Tools/jdk1.7.0_51/bin/java 300
sudo update-alternatives --config javac,再选择相应的Priority 300
sudo update-alternatives --config java,再选择相应的Priority 300
至此配置完成,输入java -version、javac或java检查是否配置成功。
===========================================
另外在编译过程中,根据环境不同,可能有些遗漏的库需要安装,
可以通过 apt-get install 安装必要的组件。这个只有见招拆招了。
四,编译错误处理·(此部分是摘抄网上博客)
【Android源代码编译】Ubuntu13.04编译android 2.3源代码时出现了以下错误dalvik/vm/native/dalvik_system_Zygote.c:In function ‘setrlimitsFromArray’:
dalvik/vm/native/dalvik_system_Zygote.c:192: error: storage size of ‘rlim’isn’t known
dalvik/vm/native/dalvik_system_Zygote.c:215: warning: implicit declaration offunction ‘setrlimit’
dalvik/vm/native/dalvik_system_Zygote.c:192: warning: unused variable ‘rlim’
This error is because 2 header filesare needed while calling setrlimit function:
#include <sys/time.h>
#include <sys/resource.h>
You can check by typing "mansetrlimit":
GETRLIMIT(2) Linux Programmer'sManual GETRLIMIT(2)
NAME
getrlimit, setrlimit, prlimit - get/set resource limits
SYNOPSIS
#include <sys/time.h>
#include <sys/resource.h>
Anyway, I raise this issue to modifydalvik/vm/native/dalvik_system_Zygote.c file with the following include file:
$vi android/dalvik/vm/native/dalvik_system_Zygote.c
#include <sys/time.h>
#include <sys/resource.h>
修改后可以在ubantu13.04上可以编译通过,并且 ubuntu10.04 和 ubuntu12.04都也可以编译通过,没有影响
安装编译所需的软件包:
1 $ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-glx libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev libreadline6-dev gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib
2 $ sudoln -s /usr/lib/i386-linux-gnu/libX11.so.1 /usr/lib/i386-linux-gnu/libX11.so
如果你系统默认的gcc g++是4.7不是4.4的,会产生很多莫名其妙的编译失败,可能是你的gcc使用的比较高,gcc --version 查看下,不是4.4的话修改如下:3 $cd /usr/bin/
$sudo mv gcc gcc.bak
$sudo ln -s gcc-4.4 gcc
$sudo mv g++ g++.bak
$sudo ln -s g++-4.4 g++
4.java python 等
================================参考文章 ========================
我的系统是Ubuntu 13.04 64bit
编译碰到了各式各样的问题 我这里给出一些链接 都是我碰到问题的时候参看的
frameworks/base/include/utils/KeyedVector.h:193:31: 附注: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/CrunchCache.o] 错误 1
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Command.o] 错误 1
第一个问题 解决方式是对gcc 和g++ 降级
1、首先安装gcc4.4和g++4.4
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.42
gcc和g++的降级gcc降级:
sudo rm -rf /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
gcc -v
g++降级
sudo rm -rf /usr/bin/g++
sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++
g++ -v
这里会碰到由2个GCC 与G++
host Executable: cmu2nuance (out/host/linux-x86/obj/EXECUTABLES/cmu2nuance_intermediates/cmu2nuance)
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1
make: *** Waiting for unfinished jobs....
host Executable: coverage (out/host/linux-x86/obj/EXECUTABLES/coverage_intermediates/coverage)
这个问题我也碰到了 安装后解决
安装libncurses5-dev:i386可以解决
sudo apt-get install libncurses5-dev:i386
dalvik/vm/native/dalvik_system_Zygote.cpp: In function ‘int setrlimitsFromArray(ArrayObject*)’:dalvik/vm/native/dalvik_system_Zygote.cpp:199:19: error: aggregate ‘setrlimitsFromArray(ArrayObject*)::rlimit rlim’ has incomplete type and cannot be defined struct rlimit rlim;
dalvik/vm/native/dalvik_system_Zygote.cpp:222:43: error: ‘setrlimit’ was not declared in this scope err = setrlimit(contents[0], &rlim);
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] Error 1make: *** Waiting for unfinished jobs....
所以,这个问题只能修改源代码来解决
在dalvik/vm/native/dalvik_system_Zygote.cpp中间增加一个头文件定义#include <sys/resource.h>
#include "Dalvik.h"
#include "native/InternalNativePriv.h"
#include <sys/resource.h>
Android(4.0)编译错误:usr/bin/ld: cannot find libncurses.so.5 cannot find -lGL
$sudo apt-get installlibx11-dev:i386(libX11.so)
$ sudo apt-get installibgl1-mesa-glx:i386(libGL.so)
由于libGL.so系统默认没有进行库路径下的链接,还需要手动链接一下
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
安装这2个解决
基本就是这些问题 中国上GOOGLE比较困难 大家相互帮组吧
另外下载GMP的网址如下, 这个网址可以下载ubuntu官方各种包:
https://launchpad.net/ubuntu/precise/+source/gmp