<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Recent Posts in 'Erlang control Java?' | Pragmatic Forums</title>
    <link>http://forums.pragprog.com/forums/27/topics/293</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <description></description>
    <item>
      <title>Erlang control Java? posted by Alain O'Dea @ Wed, 02 Apr 2008 03:15:49 -0000</title>
      <description>&lt;p&gt;If you use &lt;code&gt;open_port({spawn, "command"}, [stream])&lt;/code&gt; you will be able to use standard IO streams on the Java side and message send and receive operations on the Erlang side. There is also a &lt;code&gt;line&lt;/code&gt; option which might be useful. Just make sure to use a PrintWriter or some other buffered output stream and call flush() from the Java side to send a message.&lt;/p&gt;


	&lt;p&gt;An Erlang module to dump content into the Mac &lt;span class="caps"&gt;OS X&lt;/span&gt; clipboard using the pbcopy program:&lt;br /&gt;&lt;pre&gt;
copy(Data) -&amp;gt;
    Clipboard = open_port({spawn, "pbcopy"}, [stream]),
    Clipboard ! {self(), {command, Data}},
    Clipboard ! {self(), close},
    receive
        {Clipboard, closed} -&amp;gt; true
    end.
&lt;/pre&gt;&lt;/p&gt;


	&lt;p&gt;If you bring up the Erlang docs for open_port on &lt;a href="http://www.gotapi.com/"&gt;http://www.gotapi.com/&lt;/a&gt; it explains how to communicate with the port.&lt;/p&gt;</description>
      <pubDate>Wed, 02 Apr 2008 03:15:49 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:27:293:2525</guid>
      <author>Alain O'Dea</author>
      <link>http://forums.pragprog.com/forums/27/topics/293</link>
    </item>
    <item>
      <title>Erlang control Java? posted by Chris Liaw @ Wed, 05 Mar 2008 03:50:43 -0000</title>
      <description>&lt;p&gt;Hi,&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;After i read the book of Pragmatic Erlang, i got bought into the Erlang. However, since my previous project is all Java, i do have some Java library which is not available in Erlang such as complete cryptographic library.&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;I am pretty much wanted to use Erlang distributed, concurrency and fault torelant in my program but i also need the java cryptographic library. Hence i am thinking of creating a java program which is capable to be controlled by Erlang.&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;I tried the JInterface, it works but i am exploring to use Java port, which is the IO communication of Java program with Erlang node. However, i can not seems to get it working. Is there any specific steps which i need to do to allow Erlang can send and receive messages via open_port() with Java program?&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;Thanks.&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Regards,&lt;br /&gt;Chris&lt;/p&gt;</description>
      <pubDate>Wed, 05 Mar 2008 03:50:43 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:27:293:2379</guid>
      <author>Chris Liaw</author>
      <link>http://forums.pragprog.com/forums/27/topics/293</link>
    </item>
  </channel>
</rss>
