Re: Unable to determine GraphicsConfiguration
Posted by Goofyseeker3 on Mar 03, 2024; 11:35am
URL: https://forum.jogamp.org/Unable-to-determine-GraphicsConfiguration-tp4042444p4043352.html
So I wrote a code that extracts native libs from jar directly into a java provided temporary file folder, and loads the native libraries from there, which works, no warnings or errors.
Here the code for reference:
public static void loadNativeLibrary(String[] filename, boolean loadresourcefromjar) {
try {
Path tempdir = Files.createTempDirectory("loadlib");
String[] temppath = new String[filename.length];
for (int i=0;i<filename.length;i++) {
if (loadresourcefromjar) {
File libraryfile = new File(filename[i]);
String libraryfilename = libraryfile.getName();
File tempfile = new File(tempdir.toAbsolutePath().toString(),libraryfilename);
BufferedInputStream libraryfilestream = null;
libraryfilestream = new BufferedInputStream(ClassLoader.getSystemClassLoader().getResourceAsStream(libraryfile.getPath().replace(File.separatorChar, '/')));
Files.copy(libraryfilestream, tempfile.toPath(), StandardCopyOption.REPLACE_EXISTING);
libraryfilestream.close();
temppath[i] = tempfile.toPath().toAbsolutePath().toString();
}
}
for (int i=0;i<filename.length;i++) {
System.load(temppath[i]);
}
} catch (Exception ex) {ex.printStackTrace();}
}