442 443 if (jdkhome == null && classpath == null) { 444 error("-jdkhome and -classpath not set"); 445 } 446 447 if (jdkhome != null && classpath != null) { 448 error("Both -jdkhome and -classpath are set"); 449 } 450 451 if (classlistDir == null || modulepath == null) { 452 error("-modulepath or -classlist not set"); 453 } 454 455 ClassPath cpath = null; 456 if (jdkhome != null) { 457 cpath = ClassPath.newJDKClassPath(jdkhome); 458 } else if (classpath != null) { 459 cpath = ClassPath.newInstance(classpath); 460 } 461 462 ClassListReader reader = new ClassListReader(); 463 Set<Module> modules = reader.loadModulesFrom(new File(classlistDir)); 464 Modularizer modularizer = new Modularizer(cpath, new File(modulepath), modules); 465 modularizer.run(update); 466 } 467 468 private static String getOption(String[] args, int index) { 469 if (index < args.length) { 470 return args[index]; 471 } else { 472 error(args[index-1] + ": Missing argument"); 473 } 474 return null; 475 } 476 477 private static void error(String msg) { 478 System.err.println("ERROR: " + msg); 479 System.out.println(usage()); 480 System.exit(-1); 481 } 482 483 private static String usage() { | 442 443 if (jdkhome == null && classpath == null) { 444 error("-jdkhome and -classpath not set"); 445 } 446 447 if (jdkhome != null && classpath != null) { 448 error("Both -jdkhome and -classpath are set"); 449 } 450 451 if (classlistDir == null || modulepath == null) { 452 error("-modulepath or -classlist not set"); 453 } 454 455 ClassPath cpath = null; 456 if (jdkhome != null) { 457 cpath = ClassPath.newJDKClassPath(jdkhome); 458 } else if (classpath != null) { 459 cpath = ClassPath.newInstance(classpath); 460 } 461 462 ClassListReader reader = new ClassListReader(classlistDir, "default"); 463 Set<Module> modules = reader.run(); 464 Modularizer modularizer = new Modularizer(cpath, new File(modulepath), modules); 465 modularizer.run(update); 466 } 467 468 private static String getOption(String[] args, int index) { 469 if (index < args.length) { 470 return args[index]; 471 } else { 472 error(args[index-1] + ": Missing argument"); 473 } 474 return null; 475 } 476 477 private static void error(String msg) { 478 System.err.println("ERROR: " + msg); 479 System.out.println(usage()); 480 System.exit(-1); 481 } 482 483 private static String usage() { |