This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243898 - 32 bit Dll will only load from inside the Netbeans IDE on a 32 bit system when using a Platform Application
Summary: 32 bit Dll will only load from inside the Netbeans IDE on a 32 bit system whe...
Status: RESOLVED INCOMPLETE
Alias: None
Product: apisupport
Classification: Unclassified
Component: Harness (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Martin Kozeny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-17 21:32 UTC by SBK_Lou
Modified: 2014-07-17 15:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Class file to load DLL (1.21 KB, application/octet-stream)
2014-04-17 21:32 UTC, SBK_Lou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description SBK_Lou 2014-04-17 21:32:27 UTC
Created attachment 146813 [details]
Class file to load DLL

I've followed this documentation on distributing and loading dll files:
http://wiki.netbeans.org/DevFaqNativeLibraries
http://bits.netbeans.org/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#jni

If I try to load a 32 bit dll from a standard java application it loads and I can call functions to it with no issues.

If try to load the same dll from a Netbeans platform application on the same 32 bit computer, placing the dll file in <module>/release/modules/lib/x86 as described in the above FAQ, the dll will be distributed with the program but the entire module will not load because it is unable to load the dll file. My class file for loading the DLL is attached.

It has no issues when running from within the Netbeans IDE but will not load the module when the "Package As - ZIP distribution or Installer" function is used.

Louis
Comment 1 SBK_Lou 2014-04-17 21:34:55 UTC
Also to note: using a 64 bit version of the DLL file on a 64 bit computer works perfectly in the Netbeans Platform Application. This is problem specific to 32 bit computers.
Comment 2 Jaroslav Tulach 2014-04-23 07:22:55 UTC
So the DLL is in <module>/release/modules/lib/x86, good. The code that picks this up is in http://hg.netbeans.org/releases/file/default/o.n.bootstrap/src/org/netbeans/StandardModule.java#l647
as far as I can tell. The appropriate location then depends on values of System.getProperty("os.arch") and System.getProperty("os.name") my values are "amd64" and "linux" what are the values on 32-bit windows?
Comment 3 Jaroslav Tulach 2014-04-23 07:44:42 UTC
My test on windows XP shows that arch is "x86" and name "windows xp". So your location is likely correct. Try to place breakpoint into the indicated method and see what is happening. Or at least enable logging, it should be something like 
-J-Dorg.netbeans.StandardModule\$OneModuleClassLoader.level=FINE
on command line possibly without the backslash on Windows...
Comment 4 Jaroslav Tulach 2014-04-23 09:21:52 UTC
I've just tried the sample application on Windows XP and the DLL was properly found. Then there was an error "Can't find dependent libraries" - probably the DLL depends on something else which is not present. But from the NetBeans point of view there is no problem, as far as I can tell.
Comment 5 Jaroslav Tulach 2014-04-25 10:11:19 UTC
Waiting for reply: What version of Windows should I test the app on? Is XP OK?
Comment 6 Jaroslav Tulach 2014-04-28 09:30:13 UTC
Reply that I found in my mailbox:

> I found a solution to the problem. Still might need to be something that is
> addressed within netbeans.
>
> I was able to get my dll (in <module>/release/modules/lib) with
> dependencies on winUSB.dll in the system32 folder working if I created a
> new netbeans platform application on the 32 bit computer from scratch.
>
> Any program that I start from the 64 bit computer and then transfer to a 32
> bit computer will not load the dll dependencies correctly. You can debug
> them on the 32 bit computer but it will never work outside of the Netbeans
> IDE.

In such case this is more problem of the development support, rather than module system. Moving to apisupport category for further investigation.
Comment 7 Martin Kozeny 2014-05-13 10:13:57 UTC
As I don't have 64 bit Windows I can only say that it works fine on Windows 7 32 bit. But I can see from email converastion, problem is when moving project between platforms. I will try to evalute it as I have opportunity on 64 bit architecture.
Comment 8 Martin Kozeny 2014-05-14 07:16:49 UTC
Today I've tried to test, wheter application with its modules created on Windows 7 64 bit transfered to 32 bit version of Win 7 has problem with loading dll library and everything worked fine for me. So the problem is probably somewhere else.
Comment 9 Martin Kozeny 2014-07-17 15:12:19 UTC
Closing as INCOMPLETE. Feel free to reopen if problem persists.