Skip to content

Commit

Permalink
Merge pull request #13 from mabruce/tempfile-deleter
Browse files Browse the repository at this point in the history
 * Clean up Windows `java.io.tmpdir` even when program messes with `java.class.path` (issue #12)
  • Loading branch information
saudet committed Feb 24, 2015
2 parents ab7237e + 146674f commit e2af6ce
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/bytedeco/javacpp/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
Expand Down Expand Up @@ -569,12 +570,14 @@ public static String loadLibrary(URL[] urls, String libnameversion) {
LinkedList<String> command = new LinkedList<String>();
command.add(System.getProperty("java.home") + "/bin/java");
command.add("-classpath");
command.add(System.getProperty("java.class.path"));
command.add((new File(Loader.class.getProtectionDomain().getCodeSource().getLocation().toURI())).toString());
command.add(Loader.class.getName());
command.add(tempDir.getAbsolutePath());
new ProcessBuilder(command).start();
} catch (IOException e) {
throw new RuntimeException(e);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
});
Expand Down

0 comments on commit e2af6ce

Please sign in to comment.