# Running Mathematica via JLink from a Servlet on Tomcat 7 Problem

I'm trying to make a java servlet running on Tomcat 7 for specilized mathematical calculations. So I want to link Wolfram Mathematica 8.0 mathkernel from my servlet via JLink (webMathmatica is not an option). I placed JLink.jar and JLinkNativeLibrary.dll into WebContent/WEB-INF/lib directory and wrote the following code:

String[] mlArgs = {"-linkmode", "launch", "-linkname", "\"path-to-mathkernel.exe\""};


But, when I launch my servlet on Tomcat, it shows dilog box with title "Choose a MathLink programm to launch". If I choose mathkernel.exe from the Mathematica folder, further calculations run fine. I think that "path-to-mathkernel.exe" is incorrect to automaticaly run mathkernel.exe. I tried to use a global path c:\program files\wolfram research\mathematica\8.0\mathkernel.exe, but i didn't succeed.

Witch path should I use? Or should I configure Tomcat to run external applications? Thanks.

-

be sure to escape the backslashes, as in "c:\\program files\\wolfram research\\mathematica\\8.0\\mathkernel.exe", and try again. I can't imagine that there would be code in MathLinkFactory that checks whether or not the call originated from Tomcat or not - I think that's even technically impossible.

I works for me as you did it (with absolute path to mathkernel, without Tomcat), so it MUST (technically) work with Tomcat too.

-