Libraryless. Click here for Pure Java version (3902L/23K).
1 | import java.lang.invoke.*; |
2 | |
3 | svoid javaLibraryPathHack() pcall { |
4 | // hack for newer JDKs to accept a change java.library.path |
5 | |
6 | // see https://stackoverflow.com/questions/15409223/adding-new-paths-for-native-libraries-at-runtime-in-java |
7 | |
8 | // set sys_paths to null so that java.library.path will be reevalueted next time it is needed |
9 | var cl = MethodHandles.privateLookupIn(ClassLoader.class, MethodHandles.lookup()); |
10 | VarHandle sys_paths = cl.findStaticVarHandle(ClassLoader.class, "sys_paths", String[].class); |
11 | sys_paths.set(null); |
12 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032891 |
Snippet name: | javaLibraryPathHack |
Eternal ID of this version: | #1032891/4 |
Text MD5: | a1fe2e295824f9aeb3f6075a7eaaa03c |
Transpilation MD5: | bd92951e31e32e6c012de17c6437261e |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-08 17:45:26 |
Source code size: | 555 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 177 / 264 |
Version history: | 3 change(s) |
Referenced in: | [show references] |