Fw: Connecting to an existing Notebook from Java
- To: mathgroup at smc.vnet.net
- Subject: [mg63673] Fw: [mg63602] Connecting to an existing Notebook from Java
- From: "Christopher Arthur" <pantagruel123 at aol.com>
- Date: Mon, 9 Jan 2006 04:49:19 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Depending on how big you want to program, one way to do it is to use to use the Java RMI (remote method interface??), which is one way to get two running JVM's to talk to each other, regardless of whether they're on the same physical computer. You might have to preface the mathematica notebook with something like this LoadJavaClass["load up an RMI listener--after you make one"] While[true, While[myListener.hearsSomething!=false, myListener.sleep(1000 miliseconds)] data=myListener@ getRMIdata .... put your notebook here ...] So the whole notebook is in a loop, and the loop checks for an RMI message every second, and when it gets it, it executes the code. Then your java program would also need an RMI class for sending the data. It's a pretty clean interface, if I remember, I think that the data you want to send has to be Serializable, but there may be more restrictions, otherwise there really isn't a lot of programming involved this way. The only hassle is that it will take some amount of administration effort to get the RMI service up and running on your computer. ----- Original Message ----- From: "Thomas Kuhn" <tho.kuhn at web.de> To: mathgroup at smc.vnet.net Subject: [mg63673] [mg63602] Connecting to an existing Notebook from Java > Hi all, > > I would like to know if it is possible to use an existing notebook from > Mathematica 5.2 within a java program using Jlink. And if it is possible, > how can I do this? > > In my mind was something like, sending the input data for example an array > of double values to the existing notebook, this calculates something and > returns the result. > > > > Every kind of help would be appreciated! > > > > Best regards > > > > Thomas Kuhn > >