InputStream in = TestLibrary.class.getResourceAsStream("/libTestLibrary.so");
try {
File tmp = File.createTempFile("libTestLibrary", "so");
tmp.deleteOnExit();
FileOutputStream out = new FileOutputStream(tmp);
while (in.available() > 0) {
out.write(in.read()); // slow
}
in.close();
out.close();
Runtime.getRuntime().load(tmp.getAbsolutePath());
} catch (FileNotFoundException e) {
} catch (IOException e) {
}