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\""};
mathKernelLink = MathLinkFactory.createKernelLink(mlArgs);
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.