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

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?

Respuestas (1)

Sean de Wolski
Sean de Wolski el 19 de Nov. de 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 comentarios

I did.
After the packaging process I have obtained three folder.
For distribution
For distribution files only
For testing
The samples folder is inside for_distribution_files_only and it is empty.
The guide provided by mathworks says:
Copy and paste the generated Java file makesqrSample1.java from the samples folder into the folder that contains the makesqr.jar package. If you used the Library Compiler, makesqr.jar is located in the for_testing folder.
I do not have any quote_fun_all3Samples2.java.
What does the packaging log say?
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);
Do you have the Computer Vision toolbox on the trial license for compiler?

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB Compiler SDK en Centro de ayuda y File Exchange.

Productos

Versión

R2021b

Etiquetas

Preguntada:

el 19 de Nov. de 2021

Comentada:

el 22 de Nov. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by