Why does my compiled application not locate a MATLAB built-in Java class with MATLAB Compiler 4.0 (R14)?

3 ビュー (過去 30 日間)
I created an application and then compiled it with MATLAB Compiler. I am modifying the dynamic Java classpath in my MATLAB code using javaclasspath as follows:
javaclasspath('/usr/oracle/jdbc/classes12.jar')
My application works fine in MATLAB and on the development machine, but when I execute it on the deployed machine with the MCR, I receive the following error.
??? Undefined variable "com" or class "com.mathworks.toolbox.database.databaseConnect".
Error in ==> database.database at 78
Error in ==> testdb at 3
MATLAB:undefinedVarOrClass

採用された回答

MathWorks Support Team
MathWorks Support Team 2010 年 1 月 22 日
MATLAB Compiler uses the dynamic class path to reference JAR files used by any toolbox functions used in your application. This is because the MATLAB Compiler Runtime (MCR) only includes the base MATLAB functions, so JAR-files associated with individual toolboxes are packaged in the CTF-file. When executing the application in MATLAB, these JAR-files are on the static Java classpath, while in compiled applications they are on the dynamic classpath.
If your application needs to modify the Java classpath, you should retain any entries in the existing classpath and add the new paths. You can do this using the JAVAADDPATH function. For example:
javaaddpath('/usr/oracle/jdbc/classes12.jar')
This will prepend the directory to the dynamic classpath, leaving intact any JAR-files automatically added to the dynamic path by MATLAB Compiler.
For more information on JAVAADDPATH execute the following command at the MATLAB command prompt
doc javaaddpath

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeManage Products についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by