MATLAB Answers


Java Error when call function fom .net assembly in c#

Asked by Fernando
on 18 Jul 2013

I developed several algorithms in matlab and i want to use this on a web page that i developed. so i compiled the algorithms using .net assembly from the matlab compiler. I added the assembly in visual studio project and when i use some of the algorithms the mrc start running and then it pop up an warning saying :

unable to load java runtime environment.

after pressed ok another warning: Disabling Java Support. at last i received this error: mkl.dll the specified module could not be found

I searched over the internet and i cant find a solution for this.

i read somewhere that i need an Environment variable from jdk path, but i have done this and still no sucess.

I appreciate if someone can help me.



No products are associated with this question.

1 Answer

Answer by Friedrich
on 18 Jul 2013
Edited by Friedrich
on 18 Jul 2013
 Accepted answer


are you using R2013a? If so, the second error regarding the mkl.dll could be this:

The first parts sounds like an out of memory error or something. Loading the JVM means allocating at least 192mb of memory (or the value you set in your MATLAB preferenceses, default would be 192mb). I doubt that you need JAVA four your MATLAB program. If so, you can disable it right away from your .NET application:

[assembly: NOJVM(true)


on 19 Jul 2013

Hi there! Thank you for your reply. the mkl.dll error is now solved. But when i disabled the JVM i cant make plots. So is there any other way to solve this memory problem? best regards.

on 22 Jul 2013

The easiest would be moving to 64bit in order to resolve any memory issue you are facing. It could also more a memory fragmentation problem. Maybe try creating an instance of your MATLAB class right at the beginning (basically first line of your code) where the memory fragmentation should be smaller.

on 23 Jul 2013

Creating the object in the beginning of the application has resolved the problem.

Thank you for your help.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!