Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Question about J/Link' topicStudent Support Forum > General > Archives > "Question about J/Link"

Help | Reply To Topic
Author Comment/Response
guanaco
03/04/12 8:42pm

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


URL: ,
Help | Reply To Topic