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

后端 未结 6 1224
不思量自难忘°
不思量自难忘° 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 04:56

    I eventually found the problem which cannot be seen above. The problem (not documented anywhere) was that some of my classes use external packages that I had not imported into Matlab. I was not planning on using any of the functionalities linked with these packages.

    Nevertheless, the Matlab error message that it cannot find the class is puzzling. An error message indicating that the class cannot be used because some packages are not referenced would be most useful.

    If your package uses external packages, make sure to include all of the relevant jar files in the java classpath or Matlab will not see your dependent classes.

    Another tip that I found useful is that the Matlab function "import" will not return an error if you enter a package that does not exist, e.g., import java.doesnotexist.* works fine. However, import java.doesnotexist.aclass will not work.

    Jason

提交回复
热议问题