8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 6994413
26 * @summary Check the JDK and JVM version returned by sun.misc.Version
27 * matches the versions defined in the system properties
28 * @compile -XDignore.symbol.file Version.java
29 * @run main Version
30 */
31
32 import static sun.misc.Version.*;
33 public class Version {
34
35 public static void main(String[] args) throws Exception {
36 VersionInfo jdk = newVersionInfo(System.getProperty("java.runtime.version"));
37 VersionInfo v1 = new VersionInfo(jdkMajorVersion(),
38 jdkMinorVersion(),
39 jdkMicroVersion(),
40 jdkUpdateVersion(),
41 jdkSpecialVersion(),
42 jdkBuildNumber());
43 System.out.println("JDK version = " + jdk + " " + v1);
44 if (!jdk.equals(v1)) {
45 throw new RuntimeException("Unmatched version: " + jdk + " vs " + v1);
46 }
47 VersionInfo jvm = newVersionInfo(System.getProperty("java.vm.version"));
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 6994413
26 * @summary Check the JDK and JVM version returned by sun.misc.Version
27 * matches the versions defined in the system properties
28 * @modules java.base/sun.misc
29 * @compile -XDignore.symbol.file Version.java
30 * @run main Version
31 */
32
33 import static sun.misc.Version.*;
34 public class Version {
35
36 public static void main(String[] args) throws Exception {
37 VersionInfo jdk = newVersionInfo(System.getProperty("java.runtime.version"));
38 VersionInfo v1 = new VersionInfo(jdkMajorVersion(),
39 jdkMinorVersion(),
40 jdkMicroVersion(),
41 jdkUpdateVersion(),
42 jdkSpecialVersion(),
43 jdkBuildNumber());
44 System.out.println("JDK version = " + jdk + " " + v1);
45 if (!jdk.equals(v1)) {
46 throw new RuntimeException("Unmatched version: " + jdk + " vs " + v1);
47 }
48 VersionInfo jvm = newVersionInfo(System.getProperty("java.vm.version"));
|