Matlab cannot see some of my java classes (not all) in jar package

后端 未结 6 1225
不思量自难忘°
不思量自难忘° 2021-01-02 04:19

I have a problem that is driving me nuts. Matlab sees only some of my classes embeded in a JAR file

If I compile the classes outside of a package and add the path to

6条回答
  •  甜味超标
    2021-01-02 05:05

    This same problem can be caused by multiple types of failures. (All of them frustrating since you get NO information about what failed!) The accepted answer describes one reason and the solution. The answer by Wolfgang Kuehn gets at another possible issue, although I had trouble understanding the point so I decided to write my own answer expanding on it slightly more generally:

    Each version of Matlab ships with some specific JRE that's run and supported. Different version of Matlab ship with different version of the JRE. Not matter which version of Matlab and associated JRE you have though, if you complied your external Java classes that are in the jar file with a higher (and incompatible) version of the Java compiler, Matlab will refuse to acknowledge classes even though they are in the jar. If you're lucky, you can fix this by recompiling the Java with a flag specifying compatibility with the version of Java in your instance of Matlab.

    To find out which version of Java your Matlab is running, use this command at the Matlab command prompt:

    version -java

提交回复
热议问题