test/jdk/tools/launcher/MainClassCantBeLoadedTest.java
author mr
Wed, 16 Jan 2019 16:27:21 -0800
changeset 53372 4003935e6e5f
parent 47216 71c04702a3d5
permissions -rw-r--r--
8216532: tools/launcher/Test7029048.java fails (Solaris) Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43809
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
     1
/*
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
     4
 *
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
     8
 *
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    13
 * accompanied this code).
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    14
 *
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    18
 *
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    21
 * questions.
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    22
 */
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    23
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    24
/**
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    25
 * @test
45339
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    26
 * @bug 8174694 8181033
43809
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    27
 * @summary improve error message shown when main class can't be loaded
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    28
 * @compile MainClassCantBeLoadedTest.java
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    29
 * @run main MainClassCantBeLoadedTest
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    30
 */
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    31
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    32
import java.io.*;
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    33
import java.util.*;
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    34
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    35
public class MainClassCantBeLoadedTest extends TestHelper {
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    36
    private MainClassCantBeLoadedTest(){}
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    37
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    38
    @Test
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    39
    void testLoadingClassWithMissingSuper() throws Exception {
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    40
        if (!isEnglishLocale()) {
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    41
            return;
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    42
        }
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    43
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    44
        File cwd = new File(".");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    45
        File srcDir = new File(cwd, "src");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    46
        if (srcDir.exists()) {
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    47
            recursiveDelete(srcDir);
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    48
        }
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    49
        srcDir.mkdirs();
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    50
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    51
        /* we want to generate two classes A and B, where B is the superclass of A
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    52
         * class A has a main method
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    53
         */
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    54
        ArrayList<String> scratchpad = new ArrayList<>();
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    55
        scratchpad.add("public class A extends B {");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    56
        scratchpad.add("    public static void main(String... args) {}");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    57
        scratchpad.add("}");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    58
        createFile(new File(srcDir, "A.java"), scratchpad);
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    59
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    60
        scratchpad.clear();
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    61
        scratchpad.add("class B {}");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    62
        createFile(new File(srcDir, "B.java"), scratchpad);
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    63
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    64
        // let's compile both
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    65
        TestResult trCompilation = doExec(javacCmd,
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    66
                "-d", "out",
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    67
                new File(srcDir, "A.java").toString(),
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    68
                new File(srcDir, "B.java").toString());
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    69
        if (!trCompilation.isOK()) {
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    70
            System.err.println(trCompilation);
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    71
            throw new RuntimeException("Error: compiling");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    72
        }
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    73
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    74
        // and now B is removed
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    75
        File outDir = new File(cwd, "out");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    76
        File bClass = new File(outDir, "B.class");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    77
        bClass.delete();
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    78
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    79
        // if A is executed
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    80
        TestResult trExecution = doExec(javaCmd, "-cp", "out", "A");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    81
        // then this error message should be generated
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    82
        trExecution.contains("Error: Could not find or load main class A");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    83
        trExecution.contains("Caused by: java.lang.NoClassDefFoundError: B");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    84
        if (!trExecution.testStatus)
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    85
            System.err.println(trExecution);
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    86
    }
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
    87
45339
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    88
    @Test
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    89
    void testFailToInitializeMainClass() throws Exception {
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    90
        if (!isEnglishLocale()) {
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    91
            return;
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    92
        }
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    93
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    94
        File cwd = new File(".");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    95
        File srcDir = new File(cwd, "src");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    96
        if (srcDir.exists()) {
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    97
            recursiveDelete(srcDir);
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    98
        }
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
    99
        srcDir.mkdirs();
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   100
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   101
        /* we want to generate class C that will resolve additional class
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   102
         */
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   103
        ArrayList<String> scratchpad = new ArrayList<>();
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   104
        scratchpad.add("public class C {");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   105
        scratchpad.add("    public static void main(String... args) {");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   106
        scratchpad.add("        try {");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   107
        scratchpad.add("            System.out.println(\"loading of restricted class\");");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   108
        scratchpad.add("        } catch (Exception e) {");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   109
        scratchpad.add("            java.security.Provider p = new com.sun.crypto.provider.SunJCE();");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   110
        scratchpad.add("            p.toString();");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   111
        scratchpad.add("        }");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   112
        scratchpad.add("    }");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   113
        scratchpad.add("}");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   114
        createFile(new File(srcDir, "C.java"), scratchpad);
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   115
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   116
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   117
        // Compile and execute C should succeed
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   118
        TestResult trCompilation = doExec(javacCmd,
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   119
            "--add-exports", "java.base/com.sun.crypto.provider=ALL-UNNAMED",
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   120
            "-d", "out",
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   121
            new File(srcDir, "C.java").toString());
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   122
        if (!trCompilation.isOK()) {
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   123
            System.err.println(trCompilation);
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   124
            throw new RuntimeException("Error: compiling");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   125
        }
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   126
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   127
        TestResult trExecution = doExec(javaCmd,
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   128
            "--add-exports", "java.base/com.sun.crypto.provider=ALL-UNNAMED",
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   129
            "-cp", "out", "C");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   130
        if (!trExecution.isOK()) {
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   131
            System.err.println(trExecution);
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   132
            throw new RuntimeException("Error: executing");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   133
        }
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   134
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   135
        // Execute C with security manager will fail with AccessControlException
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   136
        trExecution = doExec(javaCmd,
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   137
            "-Djava.security.manager",
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   138
            "--add-exports", "java.base/com.sun.crypto.provider=ALL-UNNAMED",
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   139
            "-cp", "out", "C");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   140
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   141
        // then this error message should be generated
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   142
        trExecution.contains("Error: Unable to initialize main class C");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   143
        trExecution.contains("Caused by: java.security.AccessControlException: " +
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   144
            "access denied (\"java.lang.RuntimePermission\"" +
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   145
            " \"accessClassInPackage.com.sun.crypto.provider\")");
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   146
        if (!trExecution.testStatus)
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   147
            System.err.println(trExecution);
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   148
    }
f2ab1225d11f 8181033: Confusing message: A JNI error has occurred, please check your installation and try again
mchung
parents: 43809
diff changeset
   149
43809
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   150
    public static void main(String[] args) throws Exception {
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   151
        MainClassCantBeLoadedTest a = new MainClassCantBeLoadedTest();
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   152
        a.run(args);
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   153
        if (testExitValue > 0) {
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   154
            System.out.println("Total of " + testExitValue + " failed");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   155
            throw new RuntimeException("Test failed");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   156
        } else {
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   157
            System.out.println("Test passed");
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   158
        }
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   159
    }
c3669a70a7ab 8174694: improve error message shown when main class can't be loaded
vromero
parents:
diff changeset
   160
}