Guest User

Untitled

a guest
Dec 11th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. private void LoadDll() {
  2. String home = getClass().getProtectionDomain().getCodeSource().getLocation().toString().substring(6);
  3. labelErrorLog.setText(home.substring(0, home.length() - 12));
  4. try {
  5. JarFile jar = new JarFile(home);
  6. Enumeration enumz = jar.entries();
  7. while (enumz.hasMoreElements()) {
  8. JarEntry jarFile = (JarEntry) enumz.nextElement();
  9. File f = new File(".", jarFile.getName().substring(4));
  10. if (jarFile.getName().equalsIgnoreCase("dll/adstojava.dll")) {
  11. InputStream is = jar.getInputStream(jarFile);
  12. FileOutputStream fos = new FileOutputStream(f);
  13. while (is.available() > 0) {
  14. fos.write(is.read());
  15. }
  16. fos.close();
  17. is.close();
  18. }
  19. }
  20. } catch (Exception ex) {
  21. labelErrorLog.setText("Error unwrapping ADSToJava.dll");
  22. }
  23.  
  24. System.load(home.substring(0, home.length() - 12) + java.io.File.separator + "adstojava.dll");;
  25. //System.load(System.getProperty("user.home") + java.io.File.separator + "My Documents" + java.io.File.separator + "adstojava.dll");
  26.  
  27. }
Add Comment
Please, Sign In to add comment