1 /* |
1 /* |
2 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
36 * property. Before jdk7, they should be "Sun Micro..." and "1.0". |
36 * property. Before jdk7, they should be "Sun Micro..." and "1.0". |
37 * In jdk7 onwards they should be "Oracle..." and "1.<major_version>" |
37 * In jdk7 onwards they should be "Oracle..." and "1.<major_version>" |
38 */ |
38 */ |
39 public static void main(String[] args) throws Exception { |
39 public static void main(String[] args) throws Exception { |
40 |
40 |
41 String version = verifyProperty("java.version", "[0-9]+\\.[0-9]+\\..*"); |
41 String version = verifyProperty("java.version", "[0-9]+[\\\\.[0-9]+]*\\-.*"); |
42 String major_version_spec = version.split("\\.")[1]; |
42 String version_tokens[] = version.split("-|\\."); |
|
43 String major_version_spec = version_tokens[0]; |
43 int major_version = new Integer(major_version_spec).intValue(); |
44 int major_version = new Integer(major_version_spec).intValue(); |
44 |
45 |
45 String vendor_re = "Oracle Corporation"; |
46 String vendor_re = "Oracle Corporation"; |
46 String vm_spec_version_re = "1\\." + major_version_spec; |
47 String vm_spec_version_re = major_version_spec; |
47 if (major_version < 7) { |
48 if (major_version < 7) { |
48 vendor_re = "Sun Microsystems Inc\\."; |
49 vendor_re = "Sun Microsystems Inc\\."; |
49 vm_spec_version_re = "1\\.0"; |
50 vm_spec_version_re = "1\\.0"; |
50 } |
51 } |
51 verifyProperty("java.vendor", vendor_re); |
52 verifyProperty("java.vendor", vendor_re); |