diff -up Brotli4j-1.7.1/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java.fix Brotli4j-1.7.1/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java --- Brotli4j-1.7.1/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java.fix 2022-04-27 16:07:17.625617915 +0300 +++ Brotli4j-1.7.1/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java 2022-04-27 16:11:54.854104500 +0300 @@ -34,30 +34,11 @@ public class Brotli4jLoader { static { Throwable cause = null; try { - System.loadLibrary("brotli"); - } catch (Throwable t) { - try { - String nativeLibName = System.mapLibraryName("brotli"); - String libPath = "/lib/" + getPlatform() + "/" + nativeLibName; - - File tempDir = new File(System.getProperty("java.io.tmpdir"), "com_aayushatharva_brotli4j_" + System.nanoTime()); - tempDir.mkdir(); - tempDir.deleteOnExit(); - - File tempFile = new File(tempDir, nativeLibName); - - try (InputStream in = Brotli4jLoader.class.getResourceAsStream(libPath)) { - Files.copy(in, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); - } catch (Throwable throwable) { - tempFile.delete(); - throw throwable; - } - - System.load(tempFile.getAbsolutePath()); + String nativeLibPath = "@LIBDIR@/" + System.mapLibraryName("brotli"); + System.load(nativeLibPath); } catch (Throwable throwable) { cause = throwable; } - } UNAVAILABILITY_CAUSE = cause; }