1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| [root@45790fc652d5 openjdk8]# make No CONF given, but more than one configuration found in /app/openjdk8//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: *** Cannot continue. Stop. ```
我们只需要安装提示重新 `make CONF=linux-x86_64-normal-server-fastdebug` 就行了, make 过程比较费时间,可能提出类似如下错误提示
``` shell [root@45790fc652d5 openjdk8]# make [Error] encoded value was less than 0: encode(-8.326673E-17, 5.0, 11.0, 16.0) [Error] encoded value was less than 0: encode(-0.05882353, 1.0, 24.0, 25.0) [Error] encoded value was greater than 3: encode(15.029411, 1.0, 14.0, 15.0) [Error] encoded value was less than 0: encode(-0.05882353, 1.0, 24.0, 25.0) [Error] encoded value was greater than 3: encode(15.029411, 1.0, 14.0, 15.0) [Error] encoded value was less than 0: encode(-0.05882353, 1.0, 24.0, 25.0) ```
刚开始吓了一跳,网上搜了下,这是个 bug[https://bugs.openjdk.java.net/browse/JDK-8016451](https://bugs.openjdk.java.net/browse/JDK-8016451) ,最后编译成功会看到控制台提示
``` console #
----- Build times ------- Start 2017-09-04 11:46:36 End 2017-09-04 12:02:25 00:00:31 corba 00:09:53 hotspot 00:00:21 jaxp 00:00:29 jaxws 00:03:56 jdk 00:00:38 langtools 00:15:49 TOTAL ------------------------- Finished building OpenJDK for target 'default' ```
我们再看下这个jdk的版本,果然和系统环境变量的不是一个哈
``` console [root@45790fc652d5 openjdk8]# build/linux-x86_64-normal-server-fastdebug/jdk/bin/java -version openjdk version "1.8.0-internal-fastdebug" OpenJDK Runtime Environment (build 1.8.0-internal-fastdebug-_2017_09_04_11_45-b00) OpenJDK 64-Bit Server VM (build 25.71-b00-fastdebug, mixed mode) ```
#
我们写一段简单的 java 代码分别在两个 jdk 上编译 `javac` 并运行 `java` 以获取两个 jdk 的信息,代码如下
``` java [root@45790fc652d5 ~]# cat JvmTest.java public class JvmTest { public static void main(String[] args) { System.out.println(System.getProperty("user.home")); System.out.println(System.getProperty("java.version")); System.out.println(System.getProperty("os.name")); System.out.println(System.getProperty("java.vendor.url")); } } ```
- 使用已安装jdk
``` shell [root@45790fc652d5 ~]# javac JvmTest.java [root@45790fc652d5 ~]# java JvmTest /root 1.8.0_141 Linux http://java.oracle.com/ ```
- 使用自编译jdk
``` shell [root@45790fc652d5 ~]# openjdk8/build/linux-x86_64-normal-server-fastdebug/jdk/bin/javac JvmTest.java [root@45790fc652d5 ~]# openjdk8/build/linux-x86_64-normal-server-fastdebug/jdk/bin/java JvmTest /root 1.8.0-internal-fastdebug Linux http://java.oracle.com/
|