X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f8dd17853735d2fdf1c39b81cf9cb3e4bdd54342..f72c7a89811c12f36371a251029f716176bf7e96:/src/bindings/java/org/simgrid/NativeLib.java diff --git a/src/bindings/java/org/simgrid/NativeLib.java b/src/bindings/java/org/simgrid/NativeLib.java index 5d2b646406..507a2cbf30 100644 --- a/src/bindings/java/org/simgrid/NativeLib.java +++ b/src/bindings/java/org/simgrid/NativeLib.java @@ -48,6 +48,12 @@ public final class NativeLib { NativeLib.nativeInit("simgrid"); NativeLib.nativeInit("simgrid-java"); isNativeInited = true; + + /* Don't leak the files on disk */ + if (tempDir != null) { + FileCleaner fclean = new FileCleaner(tempDir.toFile()); + fclean.run(); + } } /** Helper function trying to load one requested library */ @@ -108,8 +114,6 @@ public final class NativeLib { } tempDir = Files.createTempDirectory(tempPrefix); - // don't leak the files on disk, but remove it on JVM shutdown - Runtime.getRuntime().addShutdownHook(new Thread(new FileCleaner(tempDir.toFile()))); } /* For each possible filename of the given library on all possible OSes, try it */