Search code examples
javamatlabjava-8matlab-deploymentmatlab-java

Can Java use MATLAB methods provided host machine only has MATLAB Runtime


I am trying to call some of the functions of MATLAB via Java.

What I have on my local machine is MATLAB Runtime(64 bit) and Java 8 64 bit.

Following piece of code gives an error.

Code

//Start MATLAB asynchronously
Future<MatlabEngine> eng = MatlabEngine.startMatlabAsync();

// Get engine instance from the future result
MatlabEngine ml = eng.get();

Exception

com.mathworks.engine.EngineException: Unable to launch MATLAB or connect a shared MATLAB session.
    at com.mathworks.engine.FutureMatlab.get(FutureMatlab.java:54)
    at com.mathworks.engine.FutureMatlab.get(FutureMatlab.java:16)
    at com.poc.EngineConsoleDemo.main(EngineConsoleDemo.java:26)

Please correct me if I'm wrong, but as far as my understanding goes, having a full fledged MATLAB is not required for this to run and this should run even if there's only a MATLAB Runtime installed.

Then, if my understanding is right - why do I get this exception ?


Solution

  • No it's not possible. If it was then you'd be able to write your own version of MATLAB, with access to all MATLAB functionality, without purchasing MATLAB.

    -- Phil Goddard(From Comments)