How do i call a java program in matlab?

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

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Call Java from MATLAB 的更多信息

产品

版本

R2019a

标签

Community Treasure Hunt

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

Start Hunting!

Translated by