/*****************************************************************************
* Author : Elvins Fu [email protected]
*
* Info : Boway Inc,(C) 2016-11-26, All rights revseved.
*
* This document is summed up by the author for that the R&D install the
* Java running environment or Java development kit and build the project
* on Android 7.0 Platfrom success.
****************************************************************************/
--------------------------------------------------------
Case can be connected to external networks, using
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
-------------------------------------
Not an external network connected to the case,
ahmed@ubuntu:~$ sudo add-apt-repository ppa:webupd8team/java
ahmed@ubuntu:~$ sudo apt-get update
ahmed@ubuntu:~$ sudo apt-get install oracle-java8-installer
问题: Unable to locate package oracle-java8-installer
Solution:
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" > /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" >> /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
Then repeat the above operation , if that does not work, then download the source code to compile.
--------------------------------------------------------
At this time, install the downloaded source code
http://hg.openjdk.java.net/jdk8u/jdk8u60/ or http://download.java.net/openjdk/jdk8/ https://launchpad.net/ubuntu/+source/openjdk-8
1. Download Mercurial
Mercurial is a powerful distributed version control system. This article describes how to install the latest version of Ubuntu Mercurial fast, in fact, just a few commands you can get
sudo add-apt-repository ppa:tortoisehg-ppa/releases
sudo add-apt-repository ppa:mercurial-ppa/releases
sudo apt-get update
sudo apt-get install mercurial python-nautilus tortoisehg
2. Build file directory, download and install pre-installed environment
bule@sky:~$ hg clone http://hg.openjdk.java.net/jdk8u/jdk8u jdk8-1773f1fd0fac.tar.gz
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ ls
ASSEMBLY_EXCEPTION get_source.sh Makefile test
common LICENSE README THIRD_PARTY_README
configure make README-builds.html
There is a README-builds.html describe how to build the system, some of the details need to find their own.
3. Download the file to compile the source code (website is slow, wait for tens of minutes)
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ bash ./get_source.sh
# Repositories: corba jaxp jaxws langtools jdk hotspot nashorn
curve: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/corba curve
jaxp: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u/jaxp jaxp
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ ls
ASSEMBLY_EXCEPTION hotspot LICENSE README-builds.html
common jaxp make test
configure jaxws Makefile THIRD_PARTY_README
corba jdk nashorn
get_source.sh langtools README
4. install / update, and upgrading in openJDK7
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ sudo apt-get install aptitude
I downloaded aptitude aim is that aptitude than apt-get better-dependent process
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ sudo aptitude build-dep openjdk-7
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ sudo aptitude install openjdk-7-jdk
The environment variable configuration
bule @ sky: ~ / JDK / jdk8-1773f1fd0fac.tar.gz $ vi ~ / .bashrc (benefits placed here without explanation)
export LANG=C
export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ source ~/.bashrc
6. Configuring the Compile Options
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ bash ./configure
Want to compile a debug version, it is possible to configure additional parameters, the compiler has compiled release, such as several levels, can provide more information when debugging.
Usually the system lacks ccache, download the package to speed up the compilation speed.
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ sudo apt-get install ccache
Debug about: -enable-Debug is the equivalent --with-debug-level = fastdebug, by such parameters option enables building level. You can specify a total of three levels: release, fastdebug, slowdebug, slowdebug contains the most abundant debugging information, without this information, a lot of execution may be optimized away, when we step through, you may not see the value of some variables. So it is best to compile designated slowdebug level.
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ bash ./configure --enable-debug
Note the following information
Configuration summary:
* Debug level: fastdebug (compiler level release at this time to change fastdebug)
* JDK variant: normal
* JVM variants: server
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
Tools summary:
* Boot JDK: java version "1.7.0_121" OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-1ubuntu0.14.04.1) OpenJDK 64-Bit Server VM (build 24.121-b00, mixed mode) (at /usr/lib/jvm/java-7-openjdk-amd64)
7. Compile (time is a bit slow, be patient)
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ make
No CONF given, but more than one configuration found in /home/bule/JDK/jdk8-1773f1fd0fac.tar.gz//build.
Available configurations:
* linux-x86_64-normal-server-fastdebug
* linux-x86_64-normal-server-release
Please retry building with CONF=<config pattern> (or SPEC=<specfile>)
Makefile: 55: *** Can not continue Stop (need to specify which compiler configuration / I is the above two 64-bit mode).
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz$ make CONF=linux-x86_64-normal-server-release
Compile success
----- Build times -------
Start 2016-11-26 11:03:49
End 2016-11-26 11:18:12
00:00:21 curve
00:10:23 hotspot
00:00:16 jaxp
00:00:21 jaxws
00:02:35 jdk
00:00:27 langtools
00:14:23 TOTAL
-------------------------
Finished building OpenJDK for target 'default'
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz
bule@sky:~/JDK/jdk8-1773f1fd0fac.tar.gz/build/linux-x86_64-normal-server-fastdeb
ug / jdk / bin $ ./java -version
openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build 1.8.0-internal-fastdebug-bule_2016_11_26_10_59-b00)
OpenJDK 64-Bit Server VM (build 25.71-b00-fastdebug, mixed mode)
--------------------------------------
8. Switch Version added Ubuntu
sudo update-alternatives --install /usr/bin/java java /home/bule/JDK/jdk8-1773f1fd0fac.tar.gz/build/linux-x86_64-normal-server-release/jdk/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /home/bule/JDK/jdk8-1773f1fd0fac.tar.gz/build/linux-x86_64-normal-server-release/jdk/bin/javac 300
sudo update-alternatives --install /usr/bin/javap javap /home/bule/JDK/jdk8-1773f1fd0fac.tar.gz/build/linux-x86_64-normal-server-release/jdk/bin/javap 300
sudo update-alternatives --install /usr/bin/javah javah /home/bule/JDK/jdk8-1773f1fd0fac.tar.gz/build/linux-x86_64-normal-server-release/jdk/bin/javah 300
sudo update-alternatives --install /usr/bin/jar jar /home/bule/JDK/jdk8-1773f1fd0fac.tar.gz/build/linux-x86_64-normal-server-release/jdk/bin/jar 300
-------------------------------------
9. selective switching versions
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javah
sudo update-alternatives --config javap
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
10. Review
bule@sky:~$ java -version
openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build 1.8.0-internal-bule_2016_11_26_10_58-b00)
OpenJDK 64-Bit Server VM (build 25.71-b00, mixed mode)
11. Compile Android 7.0 project
bule @ sky: ~ / workspace / jianwen.fu / jianwen.fu / V65_7.0 $ make
build/core/config.mk:600: *** Error: could not find jdk tools.jar at /home/bule/JDK/jdk8-1773f1fd0fac.tar.gz/build/linux-x86_64-normal-server-release/jdk/bin/../lib/tools.jar, please check if your JDK was installed correctly. Stop.
Android project build / core / config.mk need tools.jar file jdk / bin /../ lib directory, but the compiler source code is not available, then view the directory with the ubuntu
bule@sky:~$ find /usr/lib/jvm -name tools.jar
/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/lib/tools.jar
Copy tools.tar directory to /home/bule/JDK/jdk8-1773f1fd0fac.tar.gz/build/linux-x86_64-normal-server-release/jdk/bin/../lib/
12. At this point you're done, you can rest assured that the project to compile Android 7.0