Error in Matlab compiled executable when using Serial()
1 回表示 (過去 30 日間)
古いコメントを表示
Hi all,
I created a Matlab executable (created with GUIDE) to communicate with an Arduino. Runs fine when started from Matlab environment. But when compiled and installed, it gives an error when using Serial():
"Error using serial (line 85) Cannot create: No class com.mathworks.toolbox.instrument.SerialComm can be located on the Java Class Path"
Does anybody know how to avoid this error?
Some additional comments:
- 'Run as an administrator' makes no difference
- Compiled and run with the same (latest) Matlab runtime.
Thanks in advance,
Guido Kooijman
0 件のコメント
回答 (2 件)
Harsheel
2015 年 7 月 20 日
It seems like the correct jar files have not been picked up during the compilation process leading to a java runtime error. To resolve this
- Create a javaclasspath.txt file in your preference directory.
Location of prefdir:
>> prefdir %if on windows, just execute >>winopen(prefdir)
- Add the following 2 entries in javaclasspath.txt:
$matlabroot/java/jar/toolbox/testmeas.jar
$matlabroot/java/jar/toolbox/instrument.jar
where $matlabroot should be substituted with your matlab root directory. You can find this by typing:
>> matlabroot
- Restart MATLAB (if open) and recompile your application.
0 件のコメント
Alexander Foster
2015 年 9 月 30 日
I have run into the same issue. I had a program which would compile and run in R2013b but when I upgraded to R2015a and recompiled it I would see, "No class com.mathworks.toolbox.instrument.SerialComm can be located on the Java Class Path".
I fixed the problem by adding the following option to my call to mcc:
-a [matlabroot]\java\jar\toolbox
where [matlabroot] is the path returned when you run the command "matlabroot".
If you use the gui to compile I believe that you can get the same effect using the "File required for your application to run" section.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Java Package Integration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!