Skip to content

Commit

Permalink
maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
TingDaoK committed Sep 7, 2024
1 parent 2a5dc32 commit e444bfc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/software/amazon/awssdk/crt/CRT.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,18 @@ public final class CRT {
// Scan for and invoke any platform specific initialization
s_platform = findPlatformImpl();
jvmInit();
String graalVMImageCode = System.getProperty("org.graalvm.nativeimage.imagecode");
try {
// If the lib is already present/loaded or is in java.library.path, just use it
System.loadLibrary(CRT_LIB_NAME);
} catch (UnsatisfiedLinkError e) {
// otherwise, load from the jar this class is in
loadLibraryFromJar();
if (graalVMImageCode != null && graalVMImageCode == "runtime") {
throw new CrtRuntimeException(
"Unable to load AWS CRT lib for GraalVM runtime: Make sure the libaws-crt-jni exists in the the directory containing the native image");
} else {
loadLibraryFromJar();
}
}

// Initialize the CRT
Expand Down

0 comments on commit e444bfc

Please sign in to comment.