1221 |
1221 |
1222 bool os::set_boot_path(char fileSep, char pathSep) { |
1222 bool os::set_boot_path(char fileSep, char pathSep) { |
1223 const char* home = Arguments::get_java_home(); |
1223 const char* home = Arguments::get_java_home(); |
1224 int home_len = (int)strlen(home); |
1224 int home_len = (int)strlen(home); |
1225 |
1225 |
1226 static const char* meta_index_dir_format = "%/lib/"; |
|
1227 static const char* meta_index_format = "%/lib/meta-index"; |
|
1228 char* meta_index = format_boot_path(meta_index_format, home, home_len, fileSep, pathSep); |
|
1229 if (meta_index == NULL) return false; |
|
1230 char* meta_index_dir = format_boot_path(meta_index_dir_format, home, home_len, fileSep, pathSep); |
|
1231 if (meta_index_dir == NULL) return false; |
|
1232 Arguments::set_meta_index_path(meta_index, meta_index_dir); |
|
1233 |
|
1234 char* sysclasspath = NULL; |
1226 char* sysclasspath = NULL; |
1235 struct stat st; |
1227 struct stat st; |
1236 |
1228 |
1237 // modular image if bootmodules.jimage exists |
1229 // modular image if bootmodules.jimage exists |
1238 char* jimage = format_boot_path("%/lib/modules/bootmodules.jimage", home, home_len, fileSep, pathSep); |
1230 char* jimage = format_boot_path("%/lib/modules/bootmodules.jimage", home, home_len, fileSep, pathSep); |
1242 Arguments::set_sysclasspath(jimage); |
1234 Arguments::set_sysclasspath(jimage); |
1243 return true; |
1235 return true; |
1244 } |
1236 } |
1245 FREE_C_HEAP_ARRAY(char, jimage); |
1237 FREE_C_HEAP_ARRAY(char, jimage); |
1246 |
1238 |
1247 // images build if rt.jar exists |
1239 // check if developer build with exploded modules |
1248 char* rt_jar = format_boot_path("%/lib/rt.jar", home, home_len, fileSep, pathSep); |
1240 char* modules_dir = format_boot_path("%/modules", home, home_len, fileSep, pathSep); |
1249 if (rt_jar == NULL) return false; |
1241 if (os::stat(modules_dir, &st) == 0) { |
1250 bool has_rt_jar = (os::stat(rt_jar, &st) == 0); |
1242 if ((st.st_mode & S_IFDIR) == S_IFDIR) { |
1251 FREE_C_HEAP_ARRAY(char, rt_jar); |
1243 sysclasspath = expand_entries_to_path(modules_dir, fileSep, pathSep); |
1252 |
1244 } |
1253 if (has_rt_jar) { |
1245 } |
1254 // Any modification to the JAR-file list, for the boot classpath must be |
1246 |
1255 // aligned with install/install/make/common/Pack.gmk. Note: boot class |
1247 // fallback to classes |
1256 // path class JARs, are stripped for StackMapTable to reduce download size. |
1248 if (sysclasspath == NULL) |
1257 static const char classpath_format[] = |
1249 sysclasspath = format_boot_path("%/classes", home, home_len, fileSep, pathSep); |
1258 "%/lib/resources.jar:" |
|
1259 "%/lib/rt.jar:" |
|
1260 "%/lib/jsse.jar:" |
|
1261 "%/lib/jce.jar:" |
|
1262 "%/lib/charsets.jar:" |
|
1263 "%/lib/jfr.jar:" |
|
1264 "%/classes"; |
|
1265 sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep); |
|
1266 } else { |
|
1267 // no rt.jar, check if developer build with exploded modules |
|
1268 char* modules_dir = format_boot_path("%/modules", home, home_len, fileSep, pathSep); |
|
1269 if (os::stat(modules_dir, &st) == 0) { |
|
1270 if ((st.st_mode & S_IFDIR) == S_IFDIR) { |
|
1271 sysclasspath = expand_entries_to_path(modules_dir, fileSep, pathSep); |
|
1272 } |
|
1273 } |
|
1274 |
|
1275 // fallback to classes |
|
1276 if (sysclasspath == NULL) |
|
1277 sysclasspath = format_boot_path("%/classes", home, home_len, fileSep, pathSep); |
|
1278 } |
|
1279 |
1250 |
1280 if (sysclasspath == NULL) return false; |
1251 if (sysclasspath == NULL) return false; |
1281 Arguments::set_sysclasspath(sysclasspath); |
1252 Arguments::set_sysclasspath(sysclasspath); |
1282 |
1253 |
1283 return true; |
1254 return true; |