<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Calling Java from MATLAB</title>
	<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/</link>
	<description>Ken &#38; Mike work on the MATLAB Desktop team</description>
	<pubDate>Mon, 23 Nov 2009 00:56:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Mike</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6676</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 17 Nov 2009 16:21:43 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6676</guid>
		<description>Ravi, What you described should work as far I understand it. Please follow up with technical support. With a little more information they should be able to help you straighten it out. &lt;a href="http://www.mathworks.com/support/service_requests/contact_support.do" rel="nofollow"&gt;http://www.mathworks.com/support/service_requests/contact_support.do&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Ravi, What you described should work as far I understand it. Please follow up with technical support. With a little more information they should be able to help you straighten it out. <a href="http://www.mathworks.com/support/service_requests/contact_support.do" rel="nofollow">http://www.mathworks.com/support/service_requests/contact_support.do</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ravikant</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6673</link>
		<dc:creator>Ravikant</dc:creator>
		<pubDate>Mon, 16 Nov 2009 22:48:56 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6673</guid>
		<description>Hi Mike,
I have a problem. I wrote .m file that calls Java classes that are provided to control a hardware. The program is working. But, I would like compile the program so that I can deploy in a different computer. But, the compiled program is not able to execute the commands. The target system has the java classes installed, I updated 'classpath.txt' and 'librarypath.txt' in the /.../local folder. I tried to find more information on Java code in the .m file and problems with compilation. I appreciate your input. 

Sincerely,
Ravi.</description>
		<content:encoded><![CDATA[<p>Hi Mike,<br />
I have a problem. I wrote .m file that calls Java classes that are provided to control a hardware. The program is working. But, I would like compile the program so that I can deploy in a different computer. But, the compiled program is not able to execute the commands. The target system has the java classes installed, I updated &#8216;classpath.txt&#8217; and &#8216;librarypath.txt&#8217; in the /&#8230;/local folder. I tried to find more information on Java code in the .m file and problems with compilation. I appreciate your input. </p>
<p>Sincerely,<br />
Ravi.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6655</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Mon, 09 Nov 2009 14:11:55 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6655</guid>
		<description>Jose,

  You need to make sure you are using the right class names and method signatures. Unlike MATLAB, Java is not forgiving when it comes to using the right inputs since it is statically typed.

You can create a log4j object with the following code:
&lt;pre class="code"&gt;
javaaddpath log4j-1.2.15.jar
logger = org.apache.log4j.Logger.getLogger(java.lang.String.class)
&lt;/pre&gt;

See the &lt;a href="http://logging.apache.org/log4j/1.2/manual.html" rel="nofollow"&gt;log4j documentation&lt;/a&gt; for more information. We won't be able to help you use these classes. For help you should post questions in the Apache forums or on the &lt;a href="http://www.mathworks.com/matlabcentral/newsreader/" rel="nofollow"&gt;MATLAB newsgroup&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Jose,</p>
<p>  You need to make sure you are using the right class names and method signatures. Unlike MATLAB, Java is not forgiving when it comes to using the right inputs since it is statically typed.</p>
<p>You can create a log4j object with the following code:</p>
<pre class="code">
javaaddpath log4j-1.2.15.jar
logger = org.apache.log4j.Logger.getLogger(java.lang.String.class)
</pre>
<p>See the <a href="http://logging.apache.org/log4j/1.2/manual.html" rel="nofollow">log4j documentation</a> for more information. We won&#8217;t be able to help you use these classes. For help you should post questions in the Apache forums or on the <a href="http://www.mathworks.com/matlabcentral/newsreader/" rel="nofollow">MATLAB newsgroup</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jose Miguel</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6653</link>
		<dc:creator>Jose Miguel</dc:creator>
		<pubDate>Fri, 06 Nov 2009 13:14:26 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6653</guid>
		<description>Hi 
First of all, thanks for the post, it is really useful. I am trying to develop a Java GUI within Matlab and I want to include the log4j API to control logging or tracing of the application.

I followed the steps how this post says. I put the log4j.jar into classpath.txt and it appeared on the list of .jar files when I executed javaclasspath. After that I called (e.g. javax.log4j.Logger) or (e.g. import('javax.log4j.*'), Logger ) but it didn’t work.

So if you could help me I’d appreciate it. If I manage to develop an interesting application including log4j API, I don’t mind to share with everyone.

Kind Regards,
Jose Miguel</description>
		<content:encoded><![CDATA[<p>Hi<br />
First of all, thanks for the post, it is really useful. I am trying to develop a Java GUI within Matlab and I want to include the log4j API to control logging or tracing of the application.</p>
<p>I followed the steps how this post says. I put the log4j.jar into classpath.txt and it appeared on the list of .jar files when I executed javaclasspath. After that I called (e.g. javax.log4j.Logger) or (e.g. import(&#8217;javax.log4j.*&#8217;), Logger ) but it didn’t work.</p>
<p>So if you could help me I’d appreciate it. If I manage to develop an interesting application including log4j API, I don’t mind to share with everyone.</p>
<p>Kind Regards,<br />
Jose Miguel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6609</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Wed, 21 Oct 2009 11:50:16 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6609</guid>
		<description>Thanks for that reply, Yair. MATLAB passes the contents of  &lt;tt&gt;java.opts&lt;/tt&gt; to the Java VM as command-line parameters at startup.</description>
		<content:encoded><![CDATA[<p>Thanks for that reply, Yair. MATLAB passes the contents of  <tt>java.opts</tt> to the Java VM as command-line parameters at startup.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6605</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Wed, 21 Oct 2009 00:38:14 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6605</guid>
		<description>Mark - try placing the -D directive in the java.opts file, as explained here: http://www.mathworks.com/support/solutions/en/data/1-18I2C/?solution=1-18I2C

Yair</description>
		<content:encoded><![CDATA[<p>Mark - try placing the -D directive in the java.opts file, as explained here: <a href="http://www.mathworks.com/support/solutions/en/data/1-18I2C/?solution=1-18I2C" rel="nofollow">http://www.mathworks.com/support/solutions/en/data/1-18I2C/?solution=1-18I2C</a></p>
<p>Yair</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6604</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Tue, 20 Oct 2009 21:03:44 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6604</guid>
		<description>I have a problem in that the Java "JMSL" classes I'm trying to call from MATLAB are commercial and license protected.  We have a filebased license and it works from normal java by passing the path to the JVM via the "-D" option.
So I tried to tell the MATLAB JVM where the license file was via the setProperty java method  This is how I tried to tell JVM about the file:

javaMethod('setProperty', 'com.imsl.license.path', 'D:\dir1\dir2\license.dat'); 
I put this at the top of the m file hoping that 
the javaMethod, javaObject and javaArray calls I made
after that would then be satisfied by finding the license.
I get an error that the license server could not be found 
Mark</description>
		<content:encoded><![CDATA[<p>I have a problem in that the Java &#8220;JMSL&#8221; classes I&#8217;m trying to call from MATLAB are commercial and license protected.  We have a filebased license and it works from normal java by passing the path to the JVM via the &#8220;-D&#8221; option.<br />
So I tried to tell the MATLAB JVM where the license file was via the setProperty java method  This is how I tried to tell JVM about the file:</p>
<p>javaMethod(&#8217;setProperty&#8217;, &#8216;com.imsl.license.path&#8217;, &#8216;D:\dir1\dir2\license.dat&#8217;);<br />
I put this at the top of the m file hoping that<br />
the javaMethod, javaObject and javaArray calls I made<br />
after that would then be satisfied by finding the license.<br />
I get an error that the license server could not be found<br />
Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bree</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6395</link>
		<dc:creator>bree</dc:creator>
		<pubDate>Thu, 06 Aug 2009 07:30:59 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6395</guid>
		<description>Hi Ken and Mike,

I received a simulation program written by someone and he asked my help to connect his simulation into matlab. SO he can use matlab function to start and stop the simulation.

Since you both are expert, I would like to ask you something about this.

To run the simulation there is a file "main" which is written in Windows NT command script (that's what written in the file property), and to change the parameters of the simulation, he can write a java-script file and call it via "main" file.

I am not familiar with java, nor with the NT command script, and I can not see what is inside the "main" file. Therefore, do you have any suggestion how to put the "main" file I described above into m-file?
So the "main" file can be run under matlab functions.

sorry if I misaddress this question.
Any response will be appreciated,

best,
-bree</description>
		<content:encoded><![CDATA[<p>Hi Ken and Mike,</p>
<p>I received a simulation program written by someone and he asked my help to connect his simulation into matlab. SO he can use matlab function to start and stop the simulation.</p>
<p>Since you both are expert, I would like to ask you something about this.</p>
<p>To run the simulation there is a file &#8220;main&#8221; which is written in Windows NT command script (that&#8217;s what written in the file property), and to change the parameters of the simulation, he can write a java-script file and call it via &#8220;main&#8221; file.</p>
<p>I am not familiar with java, nor with the NT command script, and I can not see what is inside the &#8220;main&#8221; file. Therefore, do you have any suggestion how to put the &#8220;main&#8221; file I described above into m-file?<br />
So the &#8220;main&#8221; file can be run under matlab functions.</p>
<p>sorry if I misaddress this question.<br />
Any response will be appreciated,</p>
<p>best,<br />
-bree</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6335</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 10 Jul 2009 13:40:48 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6335</guid>
		<description>Dora,

It depends on what events you want to listen for. For instance, you can set MATLAB functions as AWT listeners:
&lt;pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)"&gt;f = javax.swing.JFrame;
set(f,&lt;span style="color: #A020F0"&gt;'ComponentResizedCallback'&lt;/span&gt;, @(handle,evt) disp(evt.getSource.getSize));
f.setSize(200,200);
f.show;&lt;/pre&gt;
I think I will cover this stuff in a future post.</description>
		<content:encoded><![CDATA[<p>Dora,</p>
<p>It depends on what events you want to listen for. For instance, you can set MATLAB functions as AWT listeners:</p>
<pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">f = javax.swing.JFrame;
set(f,<span style="color: #A020F0">&#8216;ComponentResizedCallback&#8217;</span>, @(handle,evt) disp(evt.getSource.getSize));
f.setSize(200,200);
f.show;</pre>
<p>I think I will cover this stuff in a future post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dora</title>
		<link>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6332</link>
		<dc:creator>Dora</dc:creator>
		<pubDate>Fri, 10 Jul 2009 08:41:12 +0000</pubDate>
		<guid>http://blogs.mathworks.com/desktop/2009/07/06/calling-java-from-matlab/#comment-6332</guid>
		<description>With the COM external interface one can register a matlab listener for COM events.  Is the equivalent possible for Java?  I can't seem to find anything in the help files.</description>
		<content:encoded><![CDATA[<p>With the COM external interface one can register a matlab listener for COM events.  Is the equivalent possible for Java?  I can&#8217;t seem to find anything in the help files.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
