Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 11 try {
- 12 System.out.print("Path before modification: "); // checking to make sure there is a path
- 13 String currentPath = System.getProperty("java.library.path"); // getting currently set path
- 15 String newPath = "/usr/share/java/mariadb-jdbc/mariadb-java-client.jar: " + currentPath; // creating a new path by string concatnation
- 18 System.setProperty("java.library.path", newPath); // replacing path with newPath
- 19 System.out.print("Path after modification: ");
- 20 System.out.println(System.getProperty("Java.library.path")); // Prints out as null
- 21
- 22 Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
- 23 fieldSysPath.setAccessible(true);
- 24 fieldSysPath.set(null, null);
- 25 } catch (NoSuchFieldException|IllegalAccessException ex) {
- 26 Logger lgr = Logger.getLogger(Prepared.class.getName());
- 27 lgr.log(Level.SEVERE, ex.getMessage(), ex);
- 28 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement