我的代码
复制代码不知道为什么没有用
- public static void AddALinkedLibrary(){
- System.out.println("========You're adding a dynamic link library======");
- String f = System.getProperty("java.home");
- System.out.println(f);
- System.load(f + "\\bin\\attach.dll");
- System.setProperty("com.sun.tools.attach.spi.AttachProvider",f + "\\bin\\attach.dll");
- try {
- Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
- fieldSysPath.setAccessible(true);
- fieldSysPath.set(null,null);
- } catch (NoSuchFieldException | IllegalAccessException e) {
- e.printStackTrace();
- }
- System.out.println("========Congratulations on your successful addition of the Dynamic Link library======");
- }