Change the MATLAB 2016 JVM

java-8
java
matlab
trackmate
fiji
Tags: #<Tag:0x00007fb883f64530> #<Tag:0x00007fb883f8fbe0> #<Tag:0x00007fb883f8eb78> #<Tag:0x00007fb883f8dc00> #<Tag:0x00007fb883f8cdf0>

#1

This is not actually a ImageJ problem.
I’m using MATLAB 2016b and need to call the TrackMate from there via script.

Since to run TrackMate from Matlab I have to do both of them running above the same JVM and the TrackMate only runs in Java 8, a installed the JRE for Java 8 and set the variable MATLAB_JAVA to points to JRE directory.

The problem is when I set the previous mentioned variable and open the MATLAB, I receive in the prompt command a message informing that the all the configuration made are no being saved and the config file is corrupted. Checking on MATLABs forum [1] I confirm that this situation is related to the Java 8.

  • MATLAB 2016b ships Java 7;

So, I’m stuck on this.

Anybody knows any workaround?

[1] https://it.mathworks.com/matlabcentral/answers/299880-matlab-2016a-error-the-desktop-configuration-was-not-saved-successfully


#2

Dear @Helder,
I faced a similar problem some time ago with Matlab 2015b.
I used this script createMATLABShortcut.m.zip (1.4 KB)

that I found somewhere (I don’t remember where :pensive:) in the web, it creates a shortcut on the desktop that will use the java vm you want.

For me it worked well,
have a nice day
Emanuele Martini


#3

Hi @emartini, thank you very much for your help.
I’ll test and will let you (and the others) know if it worked for me.

Thank you again!


#4

I had the exact same problem but in my case the script shared by @emartini, found on the Mathworks website, did not solve the issue.


#5

I am sorry,
I think it could be the Matlab Version I used it on Matlab 2015b or the OS I am using an OSX 10.9.5

let’s hope to find something helpful,
have a nice day
Emanuele

thank @tinevez I found the matlabcentral page
https://www.mathworks.com/matlabcentral/answers/103056-how-do-i-change-the-java-virtual-machine-jvm-that-matlab-is-using-for-mac-os


#6

@tinevez, yes… I didnt work for me either…

Somebody told me that it works on MATLAB 2017a… I’ll try it and let you all know.

thank you.


#7

I just tried on Windows, and I get the following message when starting Matlab (2016a) with MATLAB_JAVA pointing to a 1.8.0 JRE:

The desktop configuration was not saved successfully

But this doen’t prevent me from starting the ImageJ.m script from within Matlab.

@Helder did you get any further error messages?
Also, did you try the workaround mentioned in your linked post:

  1. switch to a 1.7 JRE,
  2. save the layout,
  3. switch to Java 8, and
  4. select the saved layout?

As far as I understand, this should not be a blocking issue.


#8

Hi @imagejan, yes, that is the exactly message I’ve got. Of course, it doesnt prevent me either to start Fiji (Miji command).

And Yes, I have tried the workaround the you mentioned. But, If I do this, I’ve got another message telling me about the corruption of those configuration files. Even the ‘command history’ can not be retrieved!

I’ll try to use the MATLAB 2017a and see if I can start Miji and run the trackmate from there, after redirect matlab for Java 8 of course.

Thank you.


#9

Hi guys!

I’ve installed the MATLAB 2017a. After set the variable MATLAB_JAVA to point to a Java 8 JRE the Fiji/Trackmate worked fine, as expected…

So, seems that is no way to solve the problem in MATLAB 2016 but, the 2017 version works like a charm :wink:

Thank you all!


#10

Thanks for testing and following up! That is great news! :smile:


#11

@ctrueden its my pleasure.
I hope to contribute developing ImageJ in the future…