11
$\begingroup$

What is the simplest way to set up LinkSnooper to monitor the communication between the Kernel and the Front End?

I am looking for an answer that works on all platforms, including 32-bit Windows.

$\endgroup$
  • 1
    $\begingroup$ I just copied your commented command and it worked on V10.0.1 in Win7 64. :/ $\endgroup$ – Kuba Nov 19 '14 at 17:52
  • $\begingroup$ @Kuba. Thank you very much for testing it. I have 32 bits Windows 7 Professional, Mathematica V 10.0.1. This is what I did. Kernel Configuration Options, next Add. Kernel Name LinkSnooper, Advanced Options checked, the above string copied and pasted in the MLOpen field. After two times OK the new kernel is visible. In a notebook Notebook's Kernel set to LinkSnooper, tried to evaluate 1+1 and the popup window appeared. The string seems to be correct, so did I forget to do something? $\endgroup$ – Fred Simons Nov 19 '14 at 18:58
  • $\begingroup$ @FredSimons You say that you are on 32-bit Windows, but the LinkSnooper command you show references the 64-bit Java directory Windows-x86-64. Does it work if you change that to the 32-bit directory Windows instead? $\endgroup$ – WReach Nov 19 '14 at 21:00
  • $\begingroup$ @WReach For a moment I thought you had the solution, but unfortunately, it does not work either. $\endgroup$ – Fred Simons Nov 20 '14 at 9:20
  • $\begingroup$ I repurposed your question to be more general. I did this because I had trouble setting up the same on OS X and your answer helped. I did have to make a few modifications to the kernel launch command line. Feel free to revert everything if you don't agree to the repurposing. $\endgroup$ – Szabolcs Nov 21 '16 at 10:59
9
$\begingroup$

Use the following command to create a new kernel setup with the name "LinkSnooper":

CurrentValue[$FrontEnd, {EvaluatorNames, "LinkSnooper"}] = {
  "AutoStartOnLaunch" -> False, 
  "MLOpenArguments" -> "-LinkMode Launch -LinkName '\"`javaw`\" -classpath \"`jlinkjar`\" com.wolfram.jlink.util.LinkSnooper -kernelname \"`mathkernel`\" -noinit'"
}

Alternatively, use the Evaluation → Kernel Configuration Options... menu to enter the same information.

This has been tested on 64-bit and 32-bit Windows, as well as on OS X.

The words enclosed in backticks (` symbol) are templates which will be automatically filled out by the front end with the correct path to Java, JLink.jar and the kernel. Some of these are placed within "..." in case the paths contain spaces. On some systems (e.g. OS X) this might still not work if there are spaces in Mathematica's path: in this case move Mathematica to a location with no spaces.


To use this kernel configuration for a notebook, evaluate the following within the notebook:

CurrentValue[EvaluationNotebook[], Evaluator] = "LinkSnooper" 

Alternatively, check LinkSnooper in the Evaluation → Notebook's Kernel menu.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.