[SOLVED] Problem getting DLLs to work

Feature Requests, Comments, Bugs, and Suggestions on the JIntellitype Java API.

[SOLVED] Problem getting DLLs to work

Postby raikia » Mon Jun 30, 2014 12:26 am

I'm trying to get JIntellitype to function with my java application, but I am stuck at the following exception:

Exception in thread "AWT-EventQueue-0" com.melloware.jintellitype.JIntellitypeException: Could not load JIntellitype.dll from local file system or from inside JAR
at com.melloware.jintellitype.JIntellitype.<init>(JIntellitype.java:114)
at com.melloware.jintellitype.JIntellitype.getInstance(JIntellitype.java:177)
at marketbot.SettingsWindow.<init>(SettingsWindow.java:27)
at marketbot.MarketBot$2.run(MarketBot.java:129)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.io.IOException: FromJarToFileSystem could not load DLL: com/melloware/jintellitype/JIntellitype.dll
at com.melloware.jintellitype.JIntellitype.fromJarToFs(JIntellitype.java:150)
at com.melloware.jintellitype.JIntellitype.<init>(JIntellitype.java:105)
... 17 more
Caused by: java.lang.NullPointerException
at com.melloware.jintellitype.JIntellitype.fromJarToFs(JIntellitype.java:146)
... 18 more



I have the DLL everywhere where they should be (honestly, I've put them every place I can imagine), and I still can't get it to work. It worked earlier today, but after a computer restart, I now get this error again.

I use netbeans, so I added the JIntellitype JAR to the project libraries, and I have the DLL in C:\Windows\System, C:\Windows\System32, main project folder, src folder, dist folder, lib folder, java jdk jre bin folder (where all the other dlls are), and nothing can seem to get it to work.

Does anyone have any ideas?

In my google quests, I did come across https://code.google.com/p/jintellitype/ ... %20Summary but I can't get that to help me at all.

I am using Intellitype.dll and not the 64-bit version because, even though I do have a 64-bit machine, I have 32-bit java (located in C:\Program Files (x86)\Java). Although I have tried both DLLs.


So, I now also tried doing a direct "System.load("C:\\Users\\Christopher\\Desktop\\jintellitype-1.3.9-dist\\jintellitype-1.3.9\\JIntellitype.dll")", but it fails with this error:

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: C:\Users\Christopher\Desktop\jintellitype-1.3.9-dist\jintellitype-1.3.9\JIntellitype.dll: A dynamic link library (DLL) initialization routine failed


From more googling, it looks like "The immediate reason for the exception is that the DLL you are loading has an initialisation function, which is failing. That is specific to that DLL, so you would need to find out what that DLL requires, to be able to initialise successfully"




So....yeah. Does anyone have any ideas why this could be failing simply after a computer restart? I've tried redownloading JIntellitype twice, but to no avail. I can see line 95 in JIntellitype.java ("System.loadLibrary("JIntellitype")") is failing because it goes to the catch blocks and tries to extract the dlls from the JAR (which doesn't exist). Even if I add them into the jar so they do exist, they are extracted successfully to the temp directory, but still crashes with the same error.


I'm not trying to do anything crazy with the initialization, this is my code:

Code: Select all
System.load("C:\\Users\\Christopher\\Desktop\\jintellitype-1.3.9-dist\\jintellitype-1.3.9\\JIntellitype.dll");
        JIntellitype.getInstance();
        JIntellitype.getInstance().registerHotKey(1, JIntellitype.MOD_CONTROL, (int)'0');
        JIntellitype.getInstance().addHotKeyListener(new HotkeyListener() {
            @Override
            public void onHotKey(int i) {
                if (i == 1)
                {
                    System.out.println("Hotkey hit!  Killing robot");
                    if (!runRobotBtn.getText().equals("Run Robot"))
                        runRobotBtnActionPerformed(null);
                }
            }
           
        });




I've been pulling my hair out on this all day, especially since it worked 100% yesterday.
raikia
 
Posts: 2
Joined: Mon Jun 30, 2014 12:20 am

Re: Problem getting DLLs to work

Postby Melloware » Mon Jun 30, 2014 3:50 pm

Wow. The DLL is failing to initialize. That tells me something might be corrupt on that machine or a permissions issue?

Can you try it on another PC?
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11016
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: Problem getting DLLs to work

Postby raikia » Mon Jun 30, 2014 4:24 pm

Well, I'm not entirely sure why, but I decided to install Java x64, switch my environment to 64-bit and use the 64 bit DLL and it now works perfectly. I guess ~magic~ happened :?


Its also strange to me that the 32-bit dll is 30 kb while the 64 bit is 458 kb. Is that correct? Its the same each time I download it from the google code site, and that just seems like a massive difference to me.
raikia
 
Posts: 2
Joined: Mon Jun 30, 2014 12:20 am

Re: Problem getting DLLs to work

Postby Melloware » Fri Jul 04, 2014 8:07 am

Nice will mark solved.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11016
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA


Return to JIntellitype

Who is online

Users browsing this forum: No registered users and 2 guests

cron