diff -r c80f6ecb0bb3 -r 5f9eee6b383b hotspot/src/share/vm/runtime/os.cpp --- a/hotspot/src/share/vm/runtime/os.cpp Tue Mar 15 13:48:21 2016 -0700 +++ b/hotspot/src/share/vm/runtime/os.cpp Thu Mar 17 19:04:01 2016 +0000 @@ -1193,67 +1193,14 @@ return formatted_path; } -// returns a PATH of all entries in the given directory that do not start with a '.' -static char* expand_entries_to_path(char* directory, char fileSep, char pathSep) { - DIR* dir = os::opendir(directory); - if (dir == NULL) return NULL; - - char* path = NULL; - size_t path_len = 0; // path length including \0 terminator - - size_t directory_len = strlen(directory); - struct dirent *entry; - char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal); - while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) { - const char* name = entry->d_name; - if (name[0] == '.') continue; - - size_t name_len = strlen(name); - size_t needed = directory_len + name_len + 2; - size_t new_len = path_len + needed; - if (path == NULL) { - path = NEW_C_HEAP_ARRAY(char, new_len, mtInternal); - } else { - path = REALLOC_C_HEAP_ARRAY(char, path, new_len, mtInternal); - } - if (path == NULL) - break; - - // append directoryname - char* p = path; - if (path_len > 0) { - p += (path_len -1); - *p = pathSep; - p++; - } - - strcpy(p, directory); - p += directory_len; - - *p = fileSep; - p++; - - strcpy(p, name); - p += name_len; - - path_len = new_len; - } - - FREE_C_HEAP_ARRAY(char, dbuf); - os::closedir(dir); - - return path; -} - bool os::set_boot_path(char fileSep, char pathSep) { const char* home = Arguments::get_java_home(); int home_len = (int)strlen(home); - char* sysclasspath = NULL; struct stat st; - // modular image if bootmodules.jimage exists - char* jimage = format_boot_path("%/lib/modules/" BOOT_IMAGE_NAME, home, home_len, fileSep, pathSep); + // modular image if "modules" jimage exists + char* jimage = format_boot_path("%/lib/" MODULES_IMAGE_NAME, home, home_len, fileSep, pathSep); if (jimage == NULL) return false; bool has_jimage = (os::stat(jimage, &st) == 0); if (has_jimage) { @@ -1264,23 +1211,16 @@ FREE_C_HEAP_ARRAY(char, jimage); // check if developer build with exploded modules - char* modules_dir = format_boot_path("%/modules", home, home_len, fileSep, pathSep); - if (os::stat(modules_dir, &st) == 0) { - if ((st.st_mode & S_IFDIR) == S_IFDIR) { - sysclasspath = expand_entries_to_path(modules_dir, fileSep, pathSep); - } + char* base_classes = format_boot_path("%/modules/java.base", home, home_len, fileSep, pathSep); + if (base_classes == NULL) return false; + if (os::stat(base_classes, &st) == 0) { + Arguments::set_sysclasspath(base_classes); + FREE_C_HEAP_ARRAY(char, base_classes); + return true; } - FREE_C_HEAP_ARRAY(char, modules_dir); + FREE_C_HEAP_ARRAY(char, base_classes); - // fallback to classes - if (sysclasspath == NULL) - sysclasspath = format_boot_path("%/classes", home, home_len, fileSep, pathSep); - - if (sysclasspath == NULL) return false; - Arguments::set_sysclasspath(sysclasspath); - FREE_C_HEAP_ARRAY(char, sysclasspath); - - return true; + return false; } /*