Compiling a Matlab Builder for Java class for an older version of Java
5 ビュー (過去 30 日間)
古いコメントを表示
[EDIT: 20110610 10:59 CDT - reformat - WDR]
I am running Matlab 2010b and Java 1.6 in my machine, in which I have built a Java class that is used by another program. I need to use this class in multiple versions of that program, including one that supports only Java 1.5 rather than 1.6.
I have changed JAVA_HOME to point to Java 1.5, however I get an error that the javabuilder.jar file is of version 50 rather than 49. Here's the complete compilation log:
ant:
<mkdir dir="C:\Isight_Krig\development\Krig_matlab\CEDGKrig\distrib" />
<mkdir dir="C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src" />
mcc -W 'java:CEDGKrig,Krig' -T link:lib -d C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src -w enable:specified_file_mismatch -w enable:repeated_file -w enable:switch_ignored -w enable:missing_lib_sentinel -w enable:demo_license -S -v 'class{Krig:C:\Isight_Krig\development\Krig_matlab\KrigLikelihood.m,C:\Isight_Krig\development\Krig_matlab\KrigPred.m}'
Compiler version: 4.14 (R2010b)
Processing include files...
2 item(s) added.
Processing directories installed with MCR...
The file C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\mccExcludedFiles.log contains a list of functions excluded from the CTF archive.
2 item(s) added.
Generating MATLAB path for the compiled application...
Created 44 path items.
Begin validation of MEX files: Fri Jun 10 16:05:08 2011
End validation of MEX files: Fri Jun 10 16:05:08 2011
Parsing file "C:\Isight_Krig\development\Krig_matlab\KrigLikelihood.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Isight_Krig\development\Krig_matlab\KrigPred.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2010b\toolbox\compiler\deploy\deployprint.m"
(Referenced from: "Compiler Command Line").
Parsing file "C:\Program Files\MATLAB\R2010b\toolbox\compiler\deploy\printdlg.m"
(Referenced from: "Compiler Command Line").
Deleting 0 temporary MEX authorization files.
Generating file "C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\readme.txt".
Executing command: ""C:\Program Files\Java\jdk1.5.0_15\bin\javac" -verbose -classpath "C:\Program Files\MATLAB\R2010b\toolbox\javabuilder\jar\javabuilder.jar" -d "C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\classes" "C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\Krig.java" "C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\CEDGKrigMCRFactory.java" "C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\CEDGKrigSharedMCRFactory.java" "C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\KrigRemote.java" "C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\package-info.java""
[parsing started C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\Krig.java]
[parsing completed 62ms]
[parsing started C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\CEDGKrigMCRFactory.java]
[parsing completed 0ms]
[parsing started C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\CEDGKrigSharedMCRFactory.java]
[parsing completed 0ms]
[parsing started C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\KrigRemote.java]
[parsing completed 0ms]
[parsing started C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\package-info.java]
[parsing completed 0ms]
[search path for source files: [C:\Program Files\MATLAB\R2010b\toolbox\javabuilder\jar\javabuilder.jar]]
[search path for class files: [C:\Program Files\Java\jdk1.5.0_15\jre\lib\rt.jar, C:\Program Files\Java\jdk1.5.0_15\jre\lib\jsse.jar, C:\Program Files\Java\jdk1.5.0_15\jre\lib\jce.jar, C:\Program Files\Java\jdk1.5.0_15\jre\lib\charsets.jar, C:\Program Files\Java\jdk1.5.0_15\jre\lib\ext\dnsns.jar, C:\Program Files\Java\jdk1.5.0_15\jre\lib\ext\localedata.jar, C:\Program Files\Java\jdk1.5.0_15\jre\lib\ext\sunjce_provider.jar, C:\Program Files\Java\jdk1.5.0_15\jre\lib\ext\sunpkcs11.jar, C:\Program Files\MATLAB\R2010b\toolbox\javabuilder\jar\javabuilder.jar]]
[loading C:\Program Files\MATLAB\R2010b\toolbox\javabuilder\jar\javabuilder.jar(com/mathworks/toolbox/javabuilder/internal/MWComponentInstance.class)]
C:\Isight_Krig\development\Krig_matlab\CEDGKrig\src\CEDGKrig\Krig.java:30: cannot access com.mathworks.toolbox.javabuilder.internal.MWComponentInstance
bad class file: C:\Program Files\MATLAB\R2010b\toolbox\javabuilder\jar\javabuilder.jar(com/mathworks/toolbox/javabuilder/internal/MWComponentInstance.class)
class file has wrong version 50.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class Krig extends MWComponentInstance<Krig>
^
[total 266ms]
1 error
Error: An error occurred while shelling out to javac (error code = 1).
Unable to build executable.
I'd be grateful for a solution to this problem. Apparently I need to do more than change the JAVA_HOME variable.
Maria
0 件のコメント
採用された回答
Kaustubha Govind
2011 年 6 月 10 日
As per the discussion on this page, it seems like the error is due to the fact that the compiled MATLAB code was built using Java 6, and Java 5 doesn't understand the format.
Perhaps you could create another version of the class file by compiling with MATLAB and JDK 1.5 and maintain it separately from the one compiled with JDK 1.6.
その他の回答 (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!