# How to set up LinkSnooper for monitoring FrontEnd--Kernel communication?

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.

• I just copied your commented command and it worked on V10.0.1 in Win7 64. :/ – Kuba Nov 19 '14 at 17:52
• @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? – Fred Simons Nov 19 '14 at 18:58
• @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? – WReach Nov 19 '14 at 21:00
• @WReach For a moment I thought you had the solution, but unfortunately, it does not work either. – Fred Simons Nov 20 '14 at 9:20
• 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. – Szabolcs Nov 21 '16 at 10:59

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"
`