diff -r 2279556f90ec -r 27050b653624 hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Mon Aug 28 23:46:22 2017 +0000 +++ b/hotspot/src/share/vm/runtime/thread.cpp Thu Aug 17 17:26:02 2017 +0200 @@ -3925,13 +3925,12 @@ } } else { // Try to load the agent from the standard dll directory - if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), + if (os::dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(), name)) { library = os::dll_load(buffer, ebuf, sizeof ebuf); } - if (library == NULL) { // Try the local directory - char ns[1] = {0}; - if (os::dll_build_name(buffer, sizeof(buffer), ns, name)) { + if (library == NULL) { // Try the library path directory. + if (os::dll_build_name(buffer, sizeof(buffer), name)) { library = os::dll_load(buffer, ebuf, sizeof ebuf); } if (library == NULL) {