publicclass Main { publicstaticvoid main(String[] args) throws Exception { // Check whether we get the BootClassLoader (not null).
ClassLoader bootClassLoader = Object.class.getClassLoader(); if (bootClassLoader == null) { thrownew IllegalStateException("Expected non-null classloader for Object");
}
// Try to load libarttest(d) with the BootClassLoader. First construct the // filename. It's in NATIVELOADER_DEFAULT_NAMESPACE_LIBS, so it's accessible // simply through the file name.
String libName = System.mapLibraryName(args[0]);
// Then call an internal function that accepts the classloader. Do not use load(), as it // is deprecated and only there for backwards compatibility, and prints a warning to the // log that we'd have to strip (it contains the pid).
Method m = Runtime.class.getDeclaredMethod("nativeLoad", String.class, ClassLoader.class);
m.setAccessible(true);
Object result = m.invoke(Runtime.getRuntime(), libName, bootClassLoader); if (result != null) { thrownew IllegalStateException(result.toString());
}
System.out.println("Success.");
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.