How do i call a java program in matlab?
Show older comments
Suppose i have this java program with a main class ("Network") and a main method.
Suppose i want to run it from a matlab script, wait for it to finish and then continue the script.
I tried different combinations of solutions i found, none of them works.
o = Net.Network();
% javaclasspath('C:\Users\****\Documents\ProjectFolder\bin\Net');
% set MATLAB_JAVA=C:\Program Files\Java\jre-9.0.4 c:> "C:\Program Files\MATLAB\R2019a\bin\matlab.exe"
javaaddpath C:\Users\****\Documents\ProjectFolder\bin\Net
javaMethod('main', o, '')
The error i get is as follows:
Error in main (line 6)
o = Network.Network();
Undefined variable "Net" or class "Net.Network".
Or the for one if i use Network as an object
Error using javaMethod
No class Network can be located on the Java class path
Error in main (line 9)
javaMethod('main', o, '')
I have been searching the internet for a solution but couldn't find any, there is just no clear way.
I would aprreciate any help! Thank you
Answers (0)
Categories
Find more on Call Java from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!