920 if (modularJarPath != null && Files.exists(modularJarPath)) {
921 return new RelativeFileSet(appResourcesRoot, new LinkedHashSet<>(Collections.singletonList(modularJarPath.toFile())));
922 }
923 }
924 }
925
926 throw new IllegalArgumentException(
927 new ConfigException(
928 MessageFormat.format(I18N.getString("error.main-jar-does-not-exist"), moduleName),
929 I18N.getString("error.main-jar-does-not-exist.advice")));
930 }
931
932 public static List<Path> getDefaultModulePath() {
933 List<Path> result = new ArrayList();
934 Path jdkModulePath = Paths.get(System.getProperty("java.home"), "jmods").toAbsolutePath();
935
936 if (jdkModulePath != null && Files.exists(jdkModulePath)) {
937 result.add(jdkModulePath);
938 }
939 else {
940 jdkModulePath = Paths.get(System.getProperty("java.home"), "../images/jmods").toAbsolutePath();
941
942 if (jdkModulePath != null && Files.exists(jdkModulePath)) {
943 result.add(jdkModulePath);
944 }
945 }
946
947 return result;
948 }
949 }
|
920 if (modularJarPath != null && Files.exists(modularJarPath)) {
921 return new RelativeFileSet(appResourcesRoot, new LinkedHashSet<>(Collections.singletonList(modularJarPath.toFile())));
922 }
923 }
924 }
925
926 throw new IllegalArgumentException(
927 new ConfigException(
928 MessageFormat.format(I18N.getString("error.main-jar-does-not-exist"), moduleName),
929 I18N.getString("error.main-jar-does-not-exist.advice")));
930 }
931
932 public static List<Path> getDefaultModulePath() {
933 List<Path> result = new ArrayList();
934 Path jdkModulePath = Paths.get(System.getProperty("java.home"), "jmods").toAbsolutePath();
935
936 if (jdkModulePath != null && Files.exists(jdkModulePath)) {
937 result.add(jdkModulePath);
938 }
939 else {
940 // On a developer build the JDK Home isn't where we expect it
941 // relative to the jmods directory. Do some extra
942 // processing to find it.
943 Map<String, String> env = System.getenv();
944
945 if (env.containsKey("JDK_HOME")) {
946 jdkModulePath = Paths.get(env.get("JDK_HOME"), ".." + File.separator + "images" + File.separator + "jmods").toAbsolutePath();
947
948 if (jdkModulePath != null && Files.exists(jdkModulePath)) {
949 result.add(jdkModulePath);
950 }
951 }
952 }
953
954 return result;
955 }
956 }
|