# 中科大 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# 阿里 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
最后在终端执行更新:
1
sudo apt-get update
根据Debian系统开发者(John Paul Adrian Glaubitz)的建议,使用如下命令安装jdk环境所有依赖:
yiji@ubuntu:~$ java -version java version "1.7.0_161" OpenJDK Runtime Environment (IcedTea 2.6.12) (7u161-2.6.12-1) OpenJDK 64-Bit Server VM (build 24.161-b01, mixed mode)
ubuntu中可以使用如下指令快速切换不同版本的jdk:
1 2 3 4 5 6 7 8 9 10 11 12
yiji@ubuntu:~$ sudo update-alternatives --config java [sudo] password for yiji: There are 3 choices for the alternative java (providing /usr/bin/java).
==================================================== A new configuration has been successfully created in /home/yiji/jdk8u/build/linux-x86_64-normal-server-fastdebug using configure arguments '--enable-debug --with-jvm-variants=server --with-boot-jdk=/usr/lib/jvm/java-7-openjdk-amd64/ --disable-precompiled-headers --with-freetype-include=/usr/include/freetype2/ --with-freetype-lib=/usr/lib/x86_64-linux-gnu'.
Configuration summary: * Debug level: 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_161" OpenJDK Runtime Environment (IcedTea 2.6.12) (7u161-2.6.12-1) OpenJDK 64-Bit Server VM (build 24.161-b01, mixed mode) (at /usr/lib/jvm/java-7-openjdk-amd64) * Toolchain: gcc (GNU Compiler Collection) * C Compiler: Version 7.3.0 (at /usr/bin/gcc) * C++ Compiler: Version 7.3.0 (at /usr/bin/g++)
WARNING: The result of this configuration has overridden an older configuration. You *should* run 'make clean' to make sure you get a proper build. Failure to do so might result in strange build problems.
生成jdk8
执行下面命令进行构建jdk:
1
make JOBS=8 MAKE_VERBOSE=y QUIETLY= LOG=debug all
生成openjdk8成功会输出耗时信息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
## Finished docs (build time 00:02:17)
----- Build times ------- Start 2018-10-26 13:36:24 End 2018-10-26 13:51:32 00:00:24 corba 00:00:19 demos 00:02:17 docs 00:07:56 hotspot 00:00:23 images 00:00:14 jaxp 00:00:20 jaxws 00:02:32 jdk 00:00:29 langtools 00:00:14 nashorn 00:15:08 TOTAL ------------------------- Finished building OpenJDK for target 'all'