From: Daryn on
We would like to execute a .m file, with JLink against Mathematica
Player Pro 7.

We are not sure if it is our java code or if the problem is in the .m
file. We can execute simple statements directly from the java program
with JLink but we get no output from a .m file (we expect the output
to be a csv-file written by Mathematica).

Here is our Java code:
------------
String[] myArgs = { "-linkmode", "launch", "-linkname",
"math -mathlink" };
KernelLink ml = null;

try {
ml = MathLinkFactory.createKernelLink(myArgs);
} catch (MathLinkException e) {
System.out.println("Fatal error opening link: " + e.getMessage());
return;
}

try {
// Get rid of the initial InputNamePacket the kernel will send
// when it is launched.
ml.discardAnswer();


String mpath = "<<"+<m-file-path>;
// String mpath = <m-file-path>; // we also
tried this

ml.putFunction("EvaluatePacket", 1);
ml.putFunction("Get", 1);
ml.put(mpath);
ml.endPacket();
int packet = ml.waitForAnswer();
System.out.println(packet);
System.out.println(ml.errorMessage());


System.out.println("Done!");

} catch (MathLinkException e) {
System.out.println("MathLinkException occurred: " +
e.getMessage());
} finally {
ml.close();
}

------------
On the console we get:
3
everything ok so far
Done!

From: Daryn on

The .m file looks like this:

Export["/home/usr/mathematica/squares.CSV", Table[{i, i^2}, {i, 0,
10}]];

Any help would be appreciated...

From: Florian Brunner on
Anyone?

We're still working on this.
Any help would be appreciated...

-Florian