How execute a jar generated with Compiler SDK from windows prompt.

10 views (last 30 days)
I have generated a java library named example.jar.
I have already setted JAVA_HOME and CLASSPATH as follow:
JAVA_HOME:
CLASSPATH:
Path with jdk:
Java version from MAtlab command line:
My function takes 3 inputs (3 paths) and has no outputs.
Once the jar has been created I am trying to launch jar file from windows prompt with the following command:
java -cp MyJar.jar "C:\Program Files\MATLAB\R2021b\toolbox\javabuilder\jar\javabuilder.jar" 'path\file1' 'path\file2' 'path\file3'
And I'm receving the following error:
Error: impossible to find or upload the main class C:\Program Files\MATLAB\R2021b\toolbox\javabuilder\jar\javabuilder.jar
Caused by: java.lang.ClassNotFoundException: C:\Program Files\MATLAB\R2021b\toolbox\javabuilder\jar\javabuilder.jar
Any suggestion?

Answers (1)

Sean de Wolski
Sean de Wolski on 19 Nov 2021
I'd strongly recommend that you create a "sample" with the Compiler SDK. Then the output will contain a getting started guide with the exact steps to run that sample and the sample will execute:
  4 Comments
Lorenzo Bernardi
Lorenzo Bernardi on 22 Nov 2021
Edited: Lorenzo Bernardi on 22 Nov 2021
Preparing Runtime...
mcc -W 'java:quote_fun_all3,Quote_fun_all3' -T link:lib -d 'C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing' 'class{Quote_fun_all3:C:\Users\Lorenzo Bernardi\TECHLAB\Rilascio_quote_fun_all3\Rilascio_quote_fun_all3\source_matlab_code\quote_fun_all3.m}'
Loading source files for package quote_fun_all3...
Constructing Javadoc information...
Creating destination directory: "C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\"
Standard Doclet version 1.8.0_252
Building tree for all the packages and classes...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\quote_fun_all3\Quote_fun_all3.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\quote_fun_all3\Quote_fun_all3MCRFactory.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\quote_fun_all3\Quote_fun_all3Remote.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\quote_fun_all3\package-frame.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\quote_fun_all3\package-summary.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\quote_fun_all3\package-tree.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\constant-values.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\serialized-form.html...
Building index for all the packages and classes...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\overview-tree.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\index-all.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\deprecated-list.html...
Building index for all classes...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\allclasses-frame.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\allclasses-noframe.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\index.html...
Generating C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_testing\doc\html\help-doc.html...
DEMO Compiler license.
The generated application will expire 30 days from today,
on Wed Dec 22 15:51:51 2021.
Packaging...
Failed to package Sample Generation for "quote_fun_all3Sample2.m". Additional details:
Error detected while evaluating example. "Undefined function 'pointCloud' for input arguments of type 'double'."
Creating the bundle...
Self contained installer created at C:\Users\Lorenzo Bernardi\OneDrive\Documenti\MATLAB\QuoteFunAll3\for_redistribution\MyAppInstaller_mcr.exe.
Packaging complete.
Elapsed packaging time was: 21 seconds.
I did'nt check the Logfile.
It seems that the problem is with the pointCloud method.
In the code I have the following instruction:
TR = stlread(filename);
ptCloud=pointCloud(TR.points);
Sean de Wolski
Sean de Wolski on 22 Nov 2021
Do you have the Computer Vision toolbox on the trial license for compiler?

Sign in to comment.

Categories

Find more on Java Package Integration in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!