Java Program crashing when launch from Matlab 2019a

11 次查看(过去 30 天)
I have a java program (.jar file) that i wish to run from Matlab 2019a.
As far as launching it goes it goes seemingly smoothly, When i click the button to launch it, it takes about 5-7 seconds and then launches fine.
From there i can navigate the program fine and some functionality of the program does infact work. Its just when i click on a certain button of the program it starts to load forever
When the program is launched from the command line it works perfectly and the same button performs near instantaneously
I just want to know where the problem could lie. Should i look more into the java program to find out what that function does differently than other functions that work with Matlab 2019a or could the issue lie with how i launch the program from Matlab. I launch it with this command:
fullpath = mfilename('fullpath')
javacmd = ['START "" /B "C:\Program Files\Java\jdk1.8.0_361\bin\java.exe" -Djna.library.path="C:\bit9prog\dev\app1\Project1\bin;" -jar ' fullpath '\..\..' '\java\Project1\target\Project1.jar'];
dos_cmd = sprintf('%s %s %s %s', javacmd, pwd);
system(dos_cmd);
If i need to give more background information for clarity do let me know
  1 个评论
Don Ellison
Don Ellison 2023-4-19
Also if anyone knows how to get output from the java program when launched from matlab it would be very helpful
For instance when launched from my terminal i use
>> Output.txt
To save all System.out.println()'s to a file called output.txt created by the program. However im not seeming to get much success from trying to include that line of code in my MATLAB launch code above but i could be inputting it wrong

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile 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