Re: [Ikvm-developers] JNI problem with the lp_solve library...
Brought to you by:
jfrijters
From: Jeroen F. <je...@su...> - 2013-08-14 08:26:13
|
Hi Albert, This is usually caused by running a 64 bit .NET executable and trying to load a 32 bit JNI library (or vice versa). The horrible performance while debugging is a known issue. Regards, Jeroen From: Albert Chan [mailto:Alb...@th...] Sent: Wednesday, August 14, 2013 9:56 To: ikv...@li... Subject: [Ikvm-developers] JNI problem with the lp_solve library... Hi IKVM developer community, Recently, my team started using ikvm 7.2 to convert a java library (produced by the Scala compiler) to a .NET dll. This Scala-java library has references to other 3rd party libraries. One of them is the lp_solve 5.5 library (http://lpsolve.sourceforge.net/5.5/) which uses JNI to talk to its native libraries. Both 32-bit and 64-bit versions of Java 6 were installed on our machine. While the java version of our library runs successfully in eclipse, the converted .NET binary exhibits a problem. When the logic executes to the point where methods from the lp_solve library are invoked, an exception is thrown with the following error: The type initializer for 'lpsolve.LpSolve' threw an exception. no lpsolve55j in java.library.path at java.lang.ClassLoader.loadLibrary(Class , String , Boolean ) at java.lang.Runtime.loadLibrary0(Class , String ) at java.lang.System.loadLibrary(String libname, CallerID ) at lpsolve.LpSolve..cctor() The lp_solve java stub library was include as one of the input jars to the ikvm conversion as follows: ikvmc.exe -out:MyLib.dll -target:library MyLib.jar liblpsolve55j.jar <other dependent libraries...> The following ikvm binaries were deployed to the same directory as our .NET executable: ikvm-native-win32-x64.dll (deployed to C:\Windows\System32 as well) ikvm-native-win32-x86.dll (deployed to C:\Windows\System32 as well) IKVM.Runtime.JNI.dll IKVM.Runtime.dll IKVM.OpenJDK.Core.dll IKVM.OpenJDK.Text.dll IKVM.OpenJDK.Util.dll IKVM.OpenJDK.XML.API.dll IKVM.OpenJDK.XML.Parse.dll The lp_solve libraries (lpsolve55j.dll, lpsolve55.dll) were deployed to the same directory as our .NET executable and: C:\Windows\System32 On a separate note, up to the point where the converted .NET executable failed, the execution took 10 minutes (running in the Visual Studio debugger) while the Java version took about 1 minute. This seems to be a very significant performance difference as well (even with a debugger attached in .NET.) Any help will be appreciated. Thanks in advance! Albert |