MCPcopy Index your code
hub / github.com/java-native-access/jna / getWebStartLibraryPath

Method getWebStartLibraryPath

src/com/sun/jna/Native.java:1343–1371  ·  view source on GitHub ↗

If running web start, determine the location of a given native library. This value may be used to properly set jna.library.path so that JNA can load libraries identified by the <nativelib> tag in the JNLP configuration file. Returns null if the Web Start native libr

(final String libName)

Source from the content-addressed store, hash-verified

1341 * @return null if unable to query the web start loader.
1342 */
1343 public static String getWebStartLibraryPath(final String libName) {
1344 if (System.getProperty("javawebstart.version") == null)
1345 return null;
1346 try {
1347
1348 final ClassLoader cl = Native.class.getClassLoader();
1349 Method m = (Method) accessControllerDoPrivileged.invoke(null, new PrivilegedAction<Method>() {
1350 @Override
1351 public Method run() {
1352 try {
1353 Method m = ClassLoader.class.getDeclaredMethod("findLibrary", new Class[] { String.class });
1354 m.setAccessible(true);
1355 return m;
1356 }
1357 catch(Exception e) {
1358 return null;
1359 }
1360 }
1361 });
1362 String libpath = (String)m.invoke(cl, new Object[] { libName });
1363 if (libpath != null) {
1364 return new File(libpath).getParent();
1365 }
1366 return null;
1367 }
1368 catch (Throwable e) {
1369 return null;
1370 }
1371 }
1372
1373 /** Perform cleanup of automatically unpacked native shared library.
1374 */

Callers 4

loadLibraryMethod · 0.95
NativeLibraryClass · 0.95

Calls 3

getPropertyMethod · 0.65
invokeMethod · 0.65
getParentMethod · 0.65

Tested by 2