Question about J/Link
- To: mathgroup at smc.vnet.net
- Subject: [mg125298] Question about J/Link
- From: guanaco <encapuchado at gmail.com>
- Date: Mon, 5 Mar 2012 02:40:11 -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