MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Question about J/Link

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125295] Question about J/Link
  • From: guanaco <encapuchado at gmail.com>
  • Date: Mon, 5 Mar 2012 01:04:52 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hi,

I'm learning to write programs in Java that call Mathematica kernel
using J/Link.

Using NetBeans I can run the examples provided in the Wolfram
directory. I even made a simple program and it runs smoothly. The
problem is if I try to run the program from a command window (MS-DOS)
using the command hinted by NetBeans i.e.:

java -jar "C:\Users\TESI\Documents\NetBeansProjects\MathematicaEigen
\dist\MathematicaEigen.jar"

I got this error message:

Fatal error: cannot find the required native library named
JLinkNativeLibrary.
Exception in thread "main" java.lang.UnsatisfiedLinkError:
com.wolfram.jlink.NativeLink.MLOpen(I[Ljava/lang/String;[Ljava/lang/
String;)J
        at com.wolfram.jlink.NativeLink.MLOpen(Native Method)
        at com.wolfram.jlink.NativeLink.<init>(NativeLink.java:140)
        at
com.wolfram.jlink.MathLinkFactory.createMathLink0(MathLinkFactory.java:
281)
        at
com.wolfram.jlink.MathLinkFactory.createMathLink(MathLinkFactory.java:
216)
        at
com.wolfram.jlink.MathLinkFactory.createKernelLink0(MathLinkFactory.java:
171)
        at
com.wolfram.jlink.MathLinkFactory.createKernelLink(MathLinkFactory.java:
98)
        at mathematicaeigen.Main.main(Main.java:22)

Please note that NetBeans puts JLink.jar in a directory called "lib"
below the directory where the jar from my program resides. Adding a -
classpath option with the direct path to JLink.jar gets me the same
error.

What I find strange is that the same program runs without problem in
NetBeans.

Any hint is appreciated.

I use Windows 7, Mathematica 8.0, and NetBeans 7.1

Thanks



C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links
\JLink\Exampl
es\Part2\SimpleFrontEnd>java -cp "C:\Program Files\Wolfram Research
\Mathematica\
8.0\SystemFiles\Links\JLink\JLink.jar" -jar "C:\Users\TESI\Documents
\NetBeansPro
jects\MathematicaEigen\dist\MathematicaEigen.jar"
Fatal error: cannot find the required native library named
JLinkNativeLibrary.
Exception in thread "main" java.lang.UnsatisfiedLinkError:
com.wolfram.jlink.Nat
iveLink.MLOpen(I[Ljava/lang/String;[Ljava/lang/String;)J
        at com.wolfram.jlink.NativeLink.MLOpen(Native Method)
        at com.wolfram.jlink.NativeLink.<init>(NativeLink.java:140)
        at
com.wolfram.jlink.MathLinkFactory.createMathLink0(MathLinkFactory.jav
a:281)
        at
com.wolfram.jlink.MathLinkFactory.createMathLink(MathLinkFactory.java
:216)
        at
com.wolfram.jlink.MathLinkFactory.createKernelLink0(MathLinkFactory.j
ava:171)
        at
com.wolfram.jlink.MathLinkFactory.createKernelLink(MathLinkFactory.ja
va:98)
        at mathematicaeigen.Main.main(Main.java:22)

C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links
\JLink\Exampl



  • Prev by Date: Re: much power to mathematica
  • Next by Date: Re: Can I solve this system of nonlinear equations?
  • Previous by thread: help with speed up
  • Next by thread: Question about J/Link