MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

FW: Sending Objects from Java - Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90945] FW: [mg90770] Sending Objects from Java - Mathematica
  • From: Jochen Adamek <tronador at cs.tu-berlin.de>
  • Date: Thu, 31 Jul 2008 02:56:18 -0400 (EDT)

Hello,

i still hope for some help about the conversion-problems to
Mathematica.

Best regards

J.A.


> -----Ursprüngliche Nachricht-----
> Von: Jochen Adamek <tronador at cs.tu-berlin.de>
> Gesendet: 23.07.08 12:29:27
> An: mathgroup at smc.vnet.net
> Betreff: [mg90770] Sending Objects from Java - Mathematica

> Dear Mathematica-experts,
> 
> i have written a Java-code, where i want to send some objects to
> Mathematica. To call a function(written in Mathematica) with four
> parameters under Java, i need to send objects to Mathematica.
> 
> This is my Java-code:
> 
> 
> public void sendListOfEdgesToMathematica(List<String> edg) throws
> MathLinkException {
> 		try { 
> 
> 		ml = MathLinkFactory.createKernelLink(argv);
> 			} catch (MathLinkException e) {
> 	        System.out.println("Fatal error opening link: " +
> e.getMessage());
> 	        return;
> 	        }
> 			
> 	        try {
> 		ml.enableObjectReferences();
> 		ml.discardAnswer();	                    
> ml.evaluate("<<C:\\Java\\AGG_Engine_Mathematica\\examples.nb");
> 		ml.discardAnswer();
> 		ml.putFunction("EvaluatePacket", 1);
> 		ml.putFunction("doGetEdges", 1);
> 		ml.put(edg);
>                 ml.endPacket();..............
> 
> edg( a list) contains the element "e11" and i have written a
Function
> under Mathematica for receiving the object from Java:
> 
> 
> doGetEdges[edg_] := 
>  JavaBlock[Module[{outStream}, outStream = edg@getOutputStream[];
>    outStream@print["Edges"];
>    edgesG6 = edg
>    ]
>   ]
> 
> The problem is, Mathematica does not receive the correct
value("e11").
> I tried to test my implementation with a PacketListener, but without
> success. After sending four objects to Mathematica, i want to call
the
> Mathematica-function under Java:
> 
> "objectGraph[edgesG6, verticesG6, sourcesG6, targetsG6]"
> 
> Any help would be fantastic.
> 
> Best regards J.Adamek
> 
> 



  • Prev by Date: RowReduce for SparseArray
  • Next by Date: Re: Plot Magic Voodoo ???
  • Previous by thread: Sending Objects from Java - Mathematica
  • Next by thread: Mathematica Special Interest Group (Washington DC Area)