From ce214bf17f0c0f6e5beafe663ea3bd7cd03ad54f Mon Sep 17 00:00:00 2001 From: duke Date: Fri, 27 Mar 2026 13:29:48 +0000 Subject: [PATCH] Backport 48846744ca96ce3c6464a1a440b9e46119dfbb88 --- src/hotspot/share/classfile/classLoader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index b8734dcea25..8bb6a94fb85 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -1386,6 +1386,10 @@ char* ClassLoader::lookup_vm_options() { jio_snprintf(modules_path, JVM_MAXPATHLEN, "%s%slib%smodules", Arguments::get_java_home(), fileSep, fileSep); JImage_file =(*JImageOpen)(modules_path, &error); if (JImage_file == nullptr) { + if (Arguments::has_jimage()) { + // The modules file exists but is unreadable or corrupt + vm_exit_during_initialization(err_msg("Unable to load %s", modules_path)); + } return nullptr; }