While I am able to use InstallJava[] (or ReinstallJava[] for that matter) with a TCP/IP link to a JVM running on the same system just fine (as shown on page 110 of the jlink user guide, e.g. for debugging purposes), I am not able, however, to get InstallJava[] working with a TCP/IP link connecting to a JVM running on a remote system.

When I try to have InstallJava[] connect to the remote JVM, the link itself seems to connect fine (because when I kill the Mathematica process, the remote JVM exits as expected), but InstallJava[] never returns and cannot be interrupted/aborted.

(Tried this with links from Linux 64 (Mathematica) to Windows 64 (jvm) and Linux 64 to Linux 64. Used JVMs installed with Mathematica and others. No problems with underlying link communications, remote or local. Just InstallJava[] hangs exclusively with remote JVMs.)


  1. Is this not supported?
  2. If it is supported, how to troubleshoot?

Thank you!


InstallJava[..] creates extra links for internal communication. By default these extra links are created with the SharedMemory protocol even though the main link that is used with InstallJava[ml] may specify the tcpip protocol. This means that the wiring/connecting of the internal links fails as they obviously cannot communicate via shared memory on remote systems.

The solution is to override the protocol these extra links use in InstallJava[] and force them to use the tcpip protocol. Then, remoting with the "installed java" feature works as expected. It would be nice, if Wolfram could adjust the InstallJava code to use the same protocol for the internal extra links as it does for the main link.

  • $\begingroup$ This answer is exactly right about the source of the problem. J/Link could be smarter about the protocol to use for the extra links. Even simpler, it should not bother to use extra links when the TCPIP protocol is in use, since that almost certainly means that the JVM is on a remote machine, and the extra links are mainly for running Java user interface elements, which would not be useful popping up on a remote machine. There is a workaround, which is to use the CreateExtraLinks->False option in InstallJava. That documentation example is very old and needs to be updated to show this option. $\endgroup$ – Todd Gayley Nov 8 '13 at 18:55
  • $\begingroup$ By the way, kudos to luke for looking at the source code and figuring the solution out. Mathematica developers don't expect users to read their source code to figure out problems (and sometimes we cringe at the thought), but there is often quite a lot to be learned by looking at the code, and users have on several occasions identified bugs in my code down to the line number. I just committed a fix to this problem in the way I suggested above--by changing the default behavior so as not to establish extra links in the case of a remote JVM. $\endgroup$ – Todd Gayley Nov 8 '13 at 19:19

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.