Matlab figure to jar file

1 visualización (últimos 30 días)
KSSV
KSSV el 1 de Dic. de 2011
Hi
I want to save a matlab file to a java file such that i can have zooming, rotate options after saving the plot. I know that deploy tool is used for this. When i tried to run the mfile before building it using deploytool I am getting the following error message:
Undefined variable "MWMCR" or class "MWMCR.getCurrent".
Error in ==> javawebfigure at 6 runtime = MWMCR.getCurrent();
Error in ==> webfigure at 50 f = javawebfigure(hnd);
Error in ==> Myfilename at 18 wf = webfigure(handle) ;
I tried to build the file using the tool, but i got error message telling:
unable to build the code....
How to solve this problem? Is there any fix for this? Thanks in advance
Sreenu https://sites.google.com/site/kolukulasivasrinivas/

Respuesta aceptada

Friedrich
Friedrich el 2 de Dic. de 2011
Hi,
where should the java application run at the end? Are you designing a web application or a classical java application?
A webfigure is designed to be displayed on a webpage, example here:
You can't translate a figure directly to a JAVA component. You can create the figure on the ML side, save it as a .fig and write a function which open that fig file. Than you compile that m file which can be executed from JAVA which will than show you the figure.
  4 comentarios
Friedrich
Friedrich el 3 de Dic. de 2011
did you put it in with that linebreak in the role? if so, it wont work I think. Please make sure that the <user username="sreenu" password="energy" roles="admin,manager-gui, manager-script"/> is one line without a break.
KSSV
KSSV el 8 de Dic. de 2011
Hi
Sorry for delayed reply....I could log in to tomcat. To deploy a matlab figure into homepage we can this tomcat. But prior to this we must have jar file ready to deploy. I am unable to make jar file for matlab figure. I get the error:
import com.mathworks.toolbox.javabuilder.internal.*; % for MWMCR
% get a reference to the current MCR
runtime = MWMCR.getCurrent();
What is the solution for this?
Sreenu

Iniciar sesión para comentar.

Más respuestas (2)

Kaustubha Govind
Kaustubha Govind el 1 de Dic. de 2011
I don't have any Java experience, but this is what I see in javawebfigure.m:
import com.mathworks.toolbox.javabuilder.internal.*; % for MWMCR
% get a reference to the current MCR
runtime = MWMCR.getCurrent();
So it looks like MATLAB cannot find the MWMCR class as expected in the com.mathworks.toolbox.javabuilder.internal.* package. I can see javabuilder.jar in $matlabroot/toolbox/javabuilder/jar/$arch - I'm assuming that this is what is required. Is the JAR file present in your MATLAB installation?
  2 comentarios
KSSV
KSSV el 2 de Dic. de 2011
Hi
Thanks for the response.
I checked in $matlabroot/toolbox/javabuilder/jar/ in this I have two files javabuilder, WebFigureQuickStart.war.I think the arch one is not there. I am using R2010a is it not available in this version?
Thanking you
Sreenu
https://sites.google.com/site/kolukulasivasrinivas/
Kaustubha Govind
Kaustubha Govind el 2 de Dic. de 2011
Yes, it looks like you do have the correct files for R2010a (my answer mentions the directory structure for R2011b). Strange - I don't have any new ideas, sorry. If possible, you could try re-installing MATLAB to be sure it's not a corrupt install. If that doesn't work, try contacting Tech Support.

Iniciar sesión para comentar.


KSSV
KSSV el 9 de Dic. de 2011
Hi
I have installed the Matlab Compiler Run time. After installation, when I run the m-file which has webfigure command in it is running good. I am getting the following response:
ans =
com.mathworks.toolbox.javabuilder.webfigures.WebFigure@6f4a71dd
Earlier I had MCR error. Now it is cleared. But when I deploy it using deploytool, I am unable to build jar file. I am getting the following error:
Error: An error occurred while shelling out to javac (error code = -1). Unable to build executable.
Any one can help me on this? Thanks in advance.
Sreenu
https://sites.google.com/site/kolukulasivasrinivas/
  15 comentarios
Friedrich
Friedrich el 16 de Dic. de 2011
Not sure what causes this. But in normally this error means that java can't find a calls for which it is looking for. In this case a class from the javabuilder.jar. Did you copy the javabuilder.jar in the lib subfolder of your Apache installation? You can check this in the netbeans project under Libraries -> Apache Tomcat -> javabuilder.jar.
KSSV
KSSV el 19 de Dic. de 2011
Hi
I am trying it...But I managed to get what I needed from the following http://www.mathworks.com/matlabcentral/fileexchange/32207
Which is very more simpler then this one...
Thanks a lot

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with MATLAB Compiler SDK en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by