hy yall,
sorry for this basic question that is not link to JME, but i didn’t found any interresting result via google, and i know that this behavior is done by JME, cause we don’t need any LD_LIBRARY_PATH to set before startup.
so what’s the ggod way to do it ?
thanks
to be more accurate on my need, the library will idealy be in a jar file
i’m going to try something based on that :
[java]public static void loadNativeLibrary() throws Exception {
if( LIB_LOADED == false ) {
String libname = System.getProperty(“os.name”)
- “_”
- System.getProperty(“os.arch”)
- “.lib”;
ClassLoader cl = Class.forName(“sqlite.tools.ASCIIDataFileLoader”)
.getClassLoader();
InputStream in = cl.getResourceAsStream(libname);
if (in == null) {
throw new Exception("libname: "
- libname
+" not found (supposed to be in sqliteimporter.jar)");
}
/*
- Extract the lib file and link it with the app
*/
File tmplib = File.createTempFile(“libsqlitejdbc-”, “.lib”);
tmplib.deleteOnExit();
OutputStream out = new FileOutputStream(tmplib);
byte[] buf = new byte[1024];
for (int len; (len = in.read(buf)) != -1;) {
out.write(buf, 0, len);
}
in.close();
out.close();
System.load(tmplib.getAbsolutePath());
LIB_LOADED = Boolean.TRUE;
}
}[/java]
found on a french website : http://astro-saada.blogspot.com/2010/05/mettre-des-librairies-natives-dans-un.html
Is that a good way ? is that who you guys do for lwjgl ?
I think what you do is just extracting the lib from the jar and copying at the root of the project, to do not have to use System.load…
arff, i really have a bad time with that