<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238828</link>
    <title>MATLAB Central Newsreader - engOpen() always returns 0</title>
    <description>Feed for thread: engOpen() always returns 0</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 07 Nov 2008 10:37:01 -0500</pubDate>
      <title>engOpen() always returns 0</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238828#609550</link>
      <author>Thomas Van Parys</author>
      <description>My aim is to call Matlab from a java plugin I'm writing.&lt;br&gt;
I was already able to do this some time ago, but since a recent re-install, the very same application just stopped working.&lt;br&gt;
&lt;br&gt;
The java application always returns 'Can't open engine' as the native function engOpen(char*) returns 0.&lt;br&gt;
&lt;br&gt;
I now tried several approaches:&lt;br&gt;
- calling engOpen(&quot;\0&quot;) from a simple enginedemo.c program&lt;br&gt;
- calling engOpen(null) from java, using JNA mapped to libeng.so&lt;br&gt;
- calling engine.engOpen() from java, using JMatLink (which uses JNI).&lt;br&gt;
&lt;br&gt;
Every time getting an engine pointer = 0&lt;br&gt;
I didn't get any errors compiling enginetest.c or compiling libJMatLink.so.&lt;br&gt;
&lt;br&gt;
compiling C example:&lt;br&gt;
gcc $(MIN) $(MLIB) -leng -lmx enginetest.c -o enginetest.out&lt;br&gt;
&lt;br&gt;
LD_LIBRARY_PATH points to $(MATLAB)/bin/glnx86&lt;br&gt;
So I'm not getting any linking errors, not when compiling, not when running... but engOpen() just fails to open a matlab engine. It simply returns 0, apparently without any further errors.&lt;br&gt;
&lt;br&gt;
What could I be missing here?&lt;br&gt;
Matlab itself works fine when I enter 'matlab' on the command line.&lt;br&gt;
&lt;br&gt;
My system:&lt;br&gt;
Fedora 9&lt;br&gt;
gcc 4.3.0&lt;br&gt;
Sun Java 1.6.0_10&lt;br&gt;
Matlab 7.6.0 (R2008a)&lt;br&gt;
&lt;br&gt;
Thanks for every hint about what could be going wrong here... I've already lost several days on this problem.</description>
    </item>
    <item>
      <pubDate>Fri, 07 Nov 2008 16:10:18 -0500</pubDate>
      <title>Re: engOpen() always returns 0</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238828#609607</link>
      <author>James Tursa</author>
      <description>&quot;Thomas Van Parys&quot; &amp;lt;thpar@plantsystemsbiology-abbreviatethis-.ugent.be&amp;gt; wrote in message &amp;lt;gf15od$8ij$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; My aim is to call Matlab from a java plugin I'm writing.&lt;br&gt;
&amp;gt; I was already able to do this some time ago, but since a recent re-install, the very same application just stopped working.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The java application always returns 'Can't open engine' as the native function engOpen(char*) returns 0.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I now tried several approaches:&lt;br&gt;
&amp;gt; - calling engOpen(&quot;\0&quot;) from a simple enginedemo.c program&lt;br&gt;
&amp;gt; - calling engOpen(null) from java, using JNA mapped to libeng.so&lt;br&gt;
&amp;gt; - calling engine.engOpen() from java, using JMatLink (which uses JNI).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Every time getting an engine pointer = 0&lt;br&gt;
&amp;gt; I didn't get any errors compiling enginetest.c or compiling libJMatLink.so.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; compiling C example:&lt;br&gt;
&amp;gt; gcc $(MIN) $(MLIB) -leng -lmx enginetest.c -o enginetest.out&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; LD_LIBRARY_PATH points to $(MATLAB)/bin/glnx86&lt;br&gt;
&amp;gt; So I'm not getting any linking errors, not when compiling, not when running... but engOpen() just fails to open a matlab engine. It simply returns 0, apparently without any further errors.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What could I be missing here?&lt;br&gt;
&amp;gt; Matlab itself works fine when I enter 'matlab' on the command line.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; My system:&lt;br&gt;
&amp;gt; Fedora 9&lt;br&gt;
&amp;gt; gcc 4.3.0&lt;br&gt;
&amp;gt; Sun Java 1.6.0_10&lt;br&gt;
&amp;gt; Matlab 7.6.0 (R2008a)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for every hint about what could be going wrong here... I've already lost several days on this problem.&lt;br&gt;
.&lt;br&gt;
If you are on Windows, try opening a Command Window (Start, All Programs, Accessories, Command Window), and then enter the following:&lt;br&gt;
.&lt;br&gt;
matlab /regserver&lt;br&gt;
.&lt;br&gt;
Then try your engine app again.&lt;br&gt;
.&lt;br&gt;
James Tursa&lt;br&gt;
.</description>
    </item>
    <item>
      <pubDate>Fri, 07 Nov 2008 17:01:03 -0500</pubDate>
      <title>Re: engOpen() always returns 0</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238828#609621</link>
      <author>Thomas Van Parys</author>
      <description>&quot;James Tursa&quot; &amp;lt;aclassyguywithaknotac@hotmail.com&amp;gt; wrote in message &amp;lt;gf1p9a$puk$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Thomas Van Parys&quot; &amp;lt;thpar@plantsystemsbiology-abbreviatethis-.ugent.be&amp;gt; wrote in message &amp;lt;gf15od$8ij$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; My system:&lt;br&gt;
&amp;gt; &amp;gt; Fedora 9&lt;br&gt;
&amp;gt; &amp;gt; gcc 4.3.0&lt;br&gt;
&amp;gt; &amp;gt; Sun Java 1.6.0_10&lt;br&gt;
&amp;gt; &amp;gt; Matlab 7.6.0 (R2008a)&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Thanks for every hint about what could be going wrong here... I've already lost several days on this problem.&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; If you are on Windows, try opening a Command Window (Start, All Programs, Accessories, Command Window), and then enter the following:&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; matlab /regserver&lt;br&gt;
&amp;gt; .&lt;br&gt;
&amp;gt; Then try your engine app again.&lt;br&gt;
&amp;gt; .&lt;br&gt;
&lt;br&gt;
Dear James,&lt;br&gt;
&lt;br&gt;
Thanks for your reply. I'm aware that in Windows, you have to register Matlab in order to get the engine working, but as said, I'm on a Fedora 9 installation.&lt;br&gt;
&lt;br&gt;
The only progress I've made today, is test my little c-program on a RedHat-server with gcc 4.1.2 and Matlab 7.5.0. Compilation and running/opening the engine worked flawless. So now I'm sure my makefile and c program are correct.&lt;br&gt;
So what could still be wrong in my local installation?&lt;br&gt;
&lt;br&gt;
regards,&lt;br&gt;
Thomas</description>
    </item>
    <item>
      <pubDate>Sat, 08 Nov 2008 21:40:18 -0500</pubDate>
      <title>Re: engOpen() always returns 0</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238828#609752</link>
      <author>James Tursa</author>
      <description>&quot;Thomas Van Parys&quot; &amp;lt;thpar@plantsystemsbiology-abbreviatethis-.ugent.be&amp;gt; wrote in message &amp;lt;gf1s8f$7uq$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ...  but as said, I'm on a Fedora 9 installation. ...&lt;br&gt;
&amp;gt; &lt;br&gt;
Ah, so you did. And all this time I thought a fedora was a hat ...&lt;br&gt;
.&lt;br&gt;
Sorry I can't help you more. I'm on WinXP and am (obviously) unfamiliar with the Fedora 9 Linux installation.&lt;br&gt;
.&lt;br&gt;
James Tursa&lt;br&gt;
.</description>
    </item>
    <item>
      <pubDate>Sun, 09 Nov 2008 17:19:02 -0500</pubDate>
      <title>Re: engOpen() always returns 0</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238828#609859</link>
      <author>Boye </author>
      <description>Hi Thomas,&lt;br&gt;
&lt;br&gt;
I had the same problem a few days ago on the newest Ubuntu distro. I suggest you check the following:&lt;br&gt;
&lt;br&gt;
- Do you have csh installed?  engOpen tries to run matlab through csh.&lt;br&gt;
&lt;br&gt;
- If csh is present, is matlab on the csh search path?  On my system, Matlab installs to /opt/matlab/bin, with a symlink from /usr/local/share. Neither is on PATH by default (this pertains to bash, I'm just guessing that csh works similarly).&lt;br&gt;
&lt;br&gt;
- You should be able to run '/bin/csh -f -c &amp;lt;matlab&amp;gt;' from the command line, where &amp;lt;matlab&amp;gt; is whatever argument you send to engOpen, or simply &quot;matlab&quot; if you send NULL.  This is the command launched by engOpen.&lt;br&gt;
&lt;br&gt;
- Finally, if all else fails, put a call to engOpen into a minimal test&lt;br&gt;
program and try 'strace -f ./test-matlab 2&amp;gt;&amp;1 |less'.  You might be able to track down the source of the problem this way.  engOpen forks/clones, the -f argument to strace makes sure it tracks the child process as well. This was at least how I found the problem on my system: the call to csh returned '-1&lt;br&gt;
ENOENT (No such file or directory)'&lt;br&gt;
&lt;br&gt;
Regards and good luck,&lt;br&gt;
&lt;br&gt;
Boye</description>
    </item>
    <item>
      <pubDate>Mon, 10 Nov 2008 15:10:03 -0500</pubDate>
      <title>Re: engOpen() always returns 0</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/238828#610043</link>
      <author>Thomas Van Parys</author>
      <description>&quot;Boye &quot; &amp;lt;boyeah@gmail-delete-this-.com&amp;gt; wrote in message &amp;lt;gf7626$r2i$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi Thomas,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I had the same problem a few days ago on the newest Ubuntu distro. I suggest you check the following:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; - Do you have csh installed?  engOpen tries to run matlab through csh.&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
Hi Boye,&lt;br&gt;
&lt;br&gt;
Your post just made my day!&lt;br&gt;
Indeed, the only thing I needed to do was install csh and everything started working again.&lt;br&gt;
And to think I lost a week on this...&lt;br&gt;
&lt;br&gt;
Thank you very much,&lt;br&gt;
Thomas</description>
    </item>
  </channel>
</rss>

