Best way to override MATLAB's default static javaclasspath

后端 未结 4 2040
南笙
南笙 2021-02-05 20:15

MATLAB is configured to search its static java class path before searching the user-modifiable dynamic path. Unfortunately, the static path contains quite a number of very old p

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-05 20:44

    Instead of obfuscating the package as suggested by @user2443532, I have found it easier to "shade" the conflicting package instead of obfuscating it - unless you actually need obfuscation. One easy way to do this is to build your package using Maven and use the maven-shade-plugin. Internal calls are modified automatically, so you don't need to modify any of the Java code.

    Direct calls from Matlab will need to be modified - for example, calls to com.opensource.Class become shaded.com.opensource.Class.

    For more info on shading, see What is the maven-shade-plugin used for, and why would you want to relocate Java packages?

提交回复
热议问题