Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void LoadDll() {
- String home = getClass().getProtectionDomain().getCodeSource().getLocation().toString().substring(6);
- labelErrorLog.setText(home.substring(0, home.length() - 12));
- try {
- JarFile jar = new JarFile(home);
- Enumeration enumz = jar.entries();
- while (enumz.hasMoreElements()) {
- JarEntry jarFile = (JarEntry) enumz.nextElement();
- File f = new File(".", jarFile.getName().substring(4));
- if (jarFile.getName().equalsIgnoreCase("dll/adstojava.dll")) {
- InputStream is = jar.getInputStream(jarFile);
- FileOutputStream fos = new FileOutputStream(f);
- while (is.available() > 0) {
- fos.write(is.read());
- }
- fos.close();
- is.close();
- }
- }
- } catch (Exception ex) {
- labelErrorLog.setText("Error unwrapping ADSToJava.dll");
- }
- System.load(home.substring(0, home.length() - 12) + java.io.File.separator + "adstojava.dll");;
- //System.load(System.getProperty("user.home") + java.io.File.separator + "My Documents" + java.io.File.separator + "adstojava.dll");
- }
Add Comment
Please, Sign In to add comment