Re: "cannot find the required native library named
- To: mathgroup at smc.vnet.net
- Subject: [mg91623] Re: "cannot find the required native library named
- From: Sascha Kratky <skratky at gmail.com>
- Date: Fri, 29 Aug 2008 04:25:32 -0400 (EDT)
- References: <g93b22$klo$1@smc.vnet.net>
On Aug 27, 12:42 pm, te... at iNumen.com wrote: > I searched this error in MathGroup and I see there is one that happened > to Linux. > > http://forums.wolfram.com/mathgroup/archive/2007/Apr/msg00078.html > > It is happening to me in Windows Server 2003 x64. I am trying to call > MathLinkFactory.createKernelLink() > > String strArg = "-linkmode launch -linkname 'C:\\Progra= m Files > (x86)\\Wolfram Research\\Mathematica\\6.0\\MathKernel.exe'"; > KernelLink ml = null; > > try { > ml = MathLinkFactory.createKernelLink(strArg); > } catch (MathLinkException e) { > System.out.println("Fatal error opening link: " + > e.getMessage()); > return; > } > > And I get the following error. > > Fatal error: cannot find the required native library named > JLinkNativeLibrary. > Exception in thread "main" java.lang.UnsatisfiedLinkError: > com.wolfram.jlink.NativeLink.MLOpenString(Ljava/lang/String;[Ljav= a/lang/Str ing;)J > at com.wolfram.jlink.NativeLink.MLOpenString(Native Metho= d) > at com.wolfram.jlink.NativeLink.<init>(NativeLink.java:11= 3) > at > com.wolfram.jlink.MathLinkFactory.createMathLink0(MathLinkFactory= .java:263) > at > com.wolfram.jlink.MathLinkFactory.createMathLink(MathLinkFactory.= java:190) > at > com.wolfram.jlink.MathLinkFactory.createKernelLink0(MathLinkFacto= ry.java:16 7) > at > com.wolfram.jlink.MathLinkFactory.createKernelLink(MathLinkFactor= y.java:65) > at SampleProgram.SampleProgram.main(SampleProgram.java:54= ) > > As pointed out in the link above, calling > MathLinkFactory.createKernelLink(""); gives the same error. > > I see that the JLinkNativeLibrary.dll is in > Mathematica\6.0\SystemFiles\Links\JLink\SystemFiles\Libraries\Windows-x86= -6 4. > How can make JLink work without this error? > > Thank you. JLink tries to find the JLinkNativeLibrary.dll in different locations of the local file system (take a look at the method NativeLink.loadNativeLibrary in the JLink source code). The location of the JLink installation directory can be explicitly specified by setting the JLINK_LIB_DIR environment variable in the Windows System control panel or by setting the Java system property "com.wolfram.jlink.libdir", i.e., try { String jLinkDir = "C:\\Program Files (x86)\\Wolfram Research\ \Mathematica\\6.0\\SystemFiles\\Links\\JLink"; System.setProperty("com.wolfram.jlink.libdir", jLinkDir); ml = MathLinkFactory.createKernelLink(strArg); ... Regards, Sascha