Problem with JAVA I guess

조회 수: 43 (최근 30일)
Dushyant Sahoo
Dushyant Sahoo 2020년 11월 23일
댓글: Dushyant Sahoo 2021년 3월 11일
I have installed MATLAB 2018b, I am running it on Ubuntu 20.04. Whenever I start the mATLAB, I get the below error-
PostVMInit failed to initialize com.mathworks.mwswing.MJStartupForDesktop
/bin/bash: run: command not found
Also, I am not able to see any workspace variables. I get a long error starting with-
Exception in thread "AWT-EventQueue-0": java.lang.NoClassDefFoundError: Could not initialize class com.mathworks.mwswing.MJStartupForDesktop
I installed MATLAB 2020a and 2020b, I have same issues with them. I tried using default JAVA shipped from MATLAB, openjdk8, openjdk11 and openjdk15, nothing resolved. It would be grateful if someone could help me with this. I am not able to see any workspace variables.
  댓글 수: 7
Mu Chiao
Mu Chiao 2020년 12월 1일
Have you tried this?
  1. Start MATLAB from command prompt using the following command:
matlab -noopengl
From this thread:
https://www.mathworks.com/matlabcentral/answers/439931-how-can-i-resolve-java-error-when-plotting-with-r2018b#answer_357272
Andrea Nardin
Andrea Nardin 2021년 3월 5일
I have the same issue and none of the proposed solutions worked for me

댓글을 달려면 로그인하십시오.

답변 (3개)

Manish Mahalwal
Manish Mahalwal 2020년 12월 2일
편집: Manish Mahalwal 2020년 12월 2일
Hi Dushyant,
The NoClassDefFoundError is a specific Java error having to do with the static class initialization. I have attached a patch which should resolve the issue. I had to zip the file because MATLAB Answers doesn't support *.tar, so unzip the file first.
  1. To install, you can do the following at your linux command line:
%% Save the mwswingPatch3.tar file to your matlabroot/java directory
% cd <matlab root>/java
% tar xvf mwswingPatch3.tar
2. Then you should restart MATLAB.
3. You should see the following messages at the top of the command line:
MJStartupForDesktop.init
MJStartupForDesktop.init - done
If for some reason there is an error, you can remove the patch by doing the following to remove the java/patch directory which was created by the patch above:
% cd <matlab root>/java
% rm -rf patch
Hope this helps.
  댓글 수: 2
Joachim Vandekerckhove
Joachim Vandekerckhove 2021년 1월 30일
Hi Manish,
I'm getting the same java exception error using R2020a (Update 6) on Ubuntu 20.10. MATLAB will boot but with a warning message "PostVMInit failed to initialize com.mathworks.mwswing.MJStartupForDesktop". The desktop largely works, but is a little buggy (tooltips don't go away once they pop up, for example), but more critically some java-heavy functions like uiimport(file) just fail with java exceptions (see attachment).
I installed your patch (thank you!), but that caused MATLAB to fail to boot entirely unless I turn off jvm. (I was able to remove the patch again.) I imagine the patch is not current for 20.10. Is there an update you can share?
Thanks,
Joachim
PS. If you have access to TWM Tech Support cases, it's #04706195.
Manish Mahalwal
Manish Mahalwal 2021년 3월 10일
Update: Joachim's issue was resolved using another patch for R2020a on Ubuntu. I have posted the patch as another answer here.

댓글을 달려면 로그인하십시오.


Larry Stern
Larry Stern 2020년 12월 15일
This sounds very much like the same issue I diagnosed on windows version of MATLAB. Cisco amp deletes one file, glugen-rt.jar located in Matlab’s \java\jarext folder.
Depending on your organization’s amp settings, the amp administrator will need to add that file to their exclusion list.
Once that happens you can copy the one file back. And then MATLAB will work correctly again.
I also opened a ticket with mathworks tech support and they are going to get their engineering team to communicate with Cisco so that the global community will not run into this issue.
  댓글 수: 2
Mohammed Al-Ghaithi
Mohammed Al-Ghaithi 2020년 12월 15일
Hey Larry
am sorry for asking you this, but I am a beginner in Matlab and I was wondering if you can help me with some uni tasks about covid19 representation
Larry Stern
Larry Stern 2020년 12월 15일
I am not a MATLAB programmer. I am a sys admin. I install MATLAB for users at a university.

댓글을 달려면 로그인하십시오.


Manish Mahalwal
Manish Mahalwal 2021년 3월 10일
For MATLAB R2020a on Ubuntu 20.
I have attached a patch which should resolve the issue. I had to zip the file because MATLAB Answers doesn't support *.tar, so unzip the file first.
1. In MATLAB, execute the following command and make a note of its location:
>> matlabroot
2. Exit from MATLAB.
3. Copy attached "mwswingPatch2020a.tar" to "matlabroot" directory.
4. Unpack the tar file by executing the following command at the Linux command line:
>> tar xvf mwswingPatch2020a.tar
5. Start MATLAB
If for some reason there are any issues, the patch can be removed by doing the following to remove the java/patch directory which was created by the patch above:
1. From the linux command line, cd to the "matlabroot".
2. Run the following command:
>> rm -rf java/patch
  댓글 수: 3
Manish Mahalwal
Manish Mahalwal 2021년 3월 11일
This is an expected behaviour. These are additional startup logging messages just to make sure the issue is avoided.
Dushyant Sahoo
Dushyant Sahoo 2021년 3월 11일
But I am still getting below message
PostVMInit failed to initialize com.mathworks.mwswing.MJStartup
/bin/bash: run: command not found
in addition to messages printed out due to the patch.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by