Matlab Compiler 產生的 JAR 在 Tomcat 中調用時,若編譯環境與運行環境 JDK 版本不一致,會拋出 Undefined function or method 'deploywhich' 錯誤。
??? Error using ==> print at 310
Undefined function or method 'deploywhich' for input arguments of type 'char'.
Matlab M-code Stack Trace ...
file /opt/MATLAB/MATLAB_Compiler_Runtime/v78/toolbox/matlab/graphics/print.m, line 310.
java -versionsetenv('MW_JAVA_HOME', '/path/to/jdk') 或修改 matlabroot/bin/javaclasspath.txtmaven.compiler.source/target、Gradle sourceCompatibility/targetCompatibility)| Matlab 版本 | MCR 版本 | 建議 JDK |
|---|---|---|
| R2014a | v83 | JDK 7 |
| R2015b | v90 | JDK 8 |
| R2018a | v94 | JDK 8 |
| R2020a+ | v98+ | JDK 8/11 |