Error during packaging Java Package
15 views (last 30 days)
Show older comments
mcc -W 'java:makesqr,Class1' -T link:lib -d 'C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing' 'class{Class1:C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr.m}'
C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\makesqr\Class1.java:81: warning: [dep-ann] deprecated item is not annotated with @Deprecated
public Class1(String pathToComponent) throws MWException
^
1 warning
Loading source files for package makesqr...
Constructing Javadoc information...
Creating destination directory: "C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\"
Building index for all the packages and classes...
Standard Doclet version 16+36-2231
Building tree for all the packages and classes...
C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\makesqr\package-info.java:9: error: heading used out of sequence: <H3>, compared to implicit preceding heading: <H1>
* <h3><b>IMPORTANT: </b>What you need to use this package successfully:</h3>
^
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\makesqr\Class1.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\makesqr\Class1Remote.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\makesqr\MakesqrMCRFactory.html...
C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\makesqr\MakesqrMCRFactory.java:54: warning: no comment
public static MWMCR newInstance() throws MWException
^
C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\makesqr\MakesqrMCRFactory.java:39: warning: no comment
public static MWMCR newInstance(MWComponentOptions componentOptions) throws MWException
^
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\makesqr\package-summary.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\makesqr\package-tree.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\serialized-form.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\overview-tree.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\deprecated-list.html...
Building index for all classes...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\allclasses-index.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\allpackages-index.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\index-all.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\index.html...
Generating C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html\help-doc.html...
1 error
2 warnings
The following command:
""C:\Program Files\Java\jdk-16\bin\javadoc" -d "C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing\doc\html" -sourcepath "C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\Examples\MagicSquareExample\MagicDemoComp\makesqr\for_testing" -classpath "C:\Program Files\MATLAB\R2021a\toolbox\javabuilder\jar\javabuilder.jar" makesqr"
failed with error code 1.
This may occur if Java is not installed, or incorrectly installed, or not on the system path,
or if the environment variable JAVA_HOME is set to an incorrect value.
_____________________________________________
--- what ist wrong? ---
Java is correct installed and environment variable JAVA_HOME is set to an correct value:
c:\>javac -version
javac 16
0 Comments
Answers (3)
Shota Kitazawa
on 22 Jun 2021
When you run "version -java" in the Matlab command window, what version of java does it show?
If it is "Java 1.8.0", you may be able to fix it by installing "JDK 8" instead of "JDK 16".
This solved the problem for me.
0 Comments
Jeff Mandel
on 11 Sep 2022
Here is some insight into the issue, and some suggestions for MathWorks. The problem is with javadoc in JDK 17. If we run mcc -v, we can see:
/mydir/package-info.java:9: error: heading used out of sequence: <H3>, compared to implicit preceding heading: <H1>
* <h3><b>IMPORTANT: </b>What you need to use this package successfully:</h3>
^
/mydir/myprogramMCRFactory.java:53: warning: no comment
public static MWMCR newInstance() throws MWException
^
/mydir/myprogramMCRFactory.java:38: warning: no comment
public static MWMCR newInstance(MWComponentOptions componentOptions) throws MWException
^
The error is a problem, as it stops mcc in its tracks. If we run mcc -K and edit package-info.java to change the <H3> tag to <H1>, javadoc from JDK 17 works. It is also possible (but nontrivial) to edit myprogramMCRFactory.java to avoid getting the warning. This would be nice, but I can live with ignoring warnings.
So where does the <H3> tag come from?
cd $MATLABROOT
grep -r "<h3><b>IMPORTANT: </b>What you need to use this package successfully:</h3>" .
Binary file ./bin/glnxa64/libmwcompiler.so matches
strings bin/glnxa64/libmwcompiler.so | grep "<h3>"
* <h3>MATLAB Runtime</h3>
* <h3>javabuilder.jar</h3>
* <h3><b>IMPORTANT: </b>What you need to use this package successfully:</h3>
So the offending string is hard coded in libmwcompiler.so (and presumably the equivalent Windows and Mac libraries). The definitive solution would be for someone to edit the source for libmwcompiler to remove the <h3> tags and use something like <strong> or <em> to convey your sense of urgency.
The issue for me is that I'm producing a .jar that is going into a Docker image, and I don't need the javadoc at all. It is just extra bytes in my image. So a flag to mcc like --nojavadoc would be really nice.
The reason this matters is that I'm using Spring Boot to call my MATLAB computational engine, and it is clear to me that when Spring Boot 3.0 arrives, I'm going to have to migrate from Java 11 to 17. I don't need all of MATLAB to support 17 (although 11 would be nice), but the Compiler SDK needs to support the LTS revision.
0 Comments
Didier DOUSSAUD
on 8 Dec 2023
My Workaround, if it can help somebody : Use javadoc of old version of java
(I'm using Windows but sure it is portable on linux)
To do it, in directory <openjdk17>\bin :
1) remove file javadoc.exe
2) create a file javadoc.bat with one line
"<jdk-11>\bin\javadoc.exe" %*
It seems ok for me, libraryCompiler call the "javadoc.bat", the doc should be not perfect but I wish the code is ok
(I have tried to replace javadoc.exe by a javadoc.bat that do nothing, but libraryCompiler raise an error for missing directory)
(I have tried to replace file javadoc.exe by sdk11 version but it doen't work)
0 Comments
See Also
Categories
Find more on Java Package Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!