22 */ 23 24 import java.io.File; 25 import java.nio.file.Files; 26 27 /* 28 * @test 29 * @summary jpackage create image with no main class arguments and with main-class attribute 30 * @library ../helpers 31 * @build JPackageHelper 32 * @build JPackagePath 33 * @modules jdk.jpackage 34 * @run main/othervm -Xmx512m ModuleMainClassErrorTest 35 */ 36 public class ModuleMainClassErrorTest { 37 private static final String OUTPUT = "output"; 38 private static final String app = JPackagePath.getApp(); 39 private static final String appOutput = JPackagePath.getAppOutputFile(); 40 41 private static final String [] CMD1 = { 42 "--output", OUTPUT, 43 "--name", "test", 44 "--module", "com.hello", 45 "--module-path", "input"}; 46 47 private static final String [] CMD2 = { 48 "--output", OUTPUT, 49 "--name", "test", 50 "--module", "com.hello/com.hello.Hello", 51 "--module-path", "input"}; 52 53 private static void validate(String buildOutput) throws Exception { 54 55 File outfile = new File(appOutput); 56 int retVal = JPackageHelper.execute(outfile, app); 57 if (retVal != 0) { 58 throw new AssertionError( 59 "Test application exited with error: "); 60 } 61 62 if (!outfile.exists()) { 63 throw new AssertionError(appOutput + " was not created"); 64 } 65 String output = Files.readString(outfile.toPath()); 66 String[] result = output.split("\n"); 67 | 22 */ 23 24 import java.io.File; 25 import java.nio.file.Files; 26 27 /* 28 * @test 29 * @summary jpackage create image with no main class arguments and with main-class attribute 30 * @library ../helpers 31 * @build JPackageHelper 32 * @build JPackagePath 33 * @modules jdk.jpackage 34 * @run main/othervm -Xmx512m ModuleMainClassErrorTest 35 */ 36 public class ModuleMainClassErrorTest { 37 private static final String OUTPUT = "output"; 38 private static final String app = JPackagePath.getApp(); 39 private static final String appOutput = JPackagePath.getAppOutputFile(); 40 41 private static final String [] CMD1 = { 42 "--package-type", "app-image", 43 "--output", OUTPUT, 44 "--name", "test", 45 "--module", "com.hello", 46 "--module-path", "input"}; 47 48 private static final String [] CMD2 = { 49 "--package-type", "app-image", 50 "--output", OUTPUT, 51 "--name", "test", 52 "--module", "com.hello/com.hello.Hello", 53 "--module-path", "input"}; 54 55 private static void validate(String buildOutput) throws Exception { 56 57 File outfile = new File(appOutput); 58 int retVal = JPackageHelper.execute(outfile, app); 59 if (retVal != 0) { 60 throw new AssertionError( 61 "Test application exited with error: "); 62 } 63 64 if (!outfile.exists()) { 65 throw new AssertionError(appOutput + " was not created"); 66 } 67 String output = Files.readString(outfile.toPath()); 68 String[] result = output.split("\n"); 69 |