MATLAB: Do I get error: package com.mathwo​rks.toolbo​x.javabuil​der.intern​al does not exist in Java program which uses MATLAB Compiled JARs

cannotcom.mathworks.toolbox.javabuilder.internalfindMATLAB Compiler SDKmwarraymwnumericarraypackagesymbol [~]

I created JAR file from MATLAB using example given on the following doc-
But, in Step 16 I am getting the error- 
error: package com.mathworks.toolbox.javabuilder.internal does not exist 
How to fix this?

Best Answer

I understand that you created the JAR file from MATLAB code and now trying to import this into a sample JAVA program.
While compiling the program you get the error-
error: package com.mathworks.toolbox.javabuilder.internal does not exist
import com.mathworks.toolbox.javabuilder.*;
^
and cannot find symbol errors for MWArray and MWNumericArray.
This all happens because the import com.mathworks.toolbox.javabuilder could not successfully import javabuilder.
The most possible reason for this is that full path to "javabuilder.jar" is not added to the _classpath_.
Compile your program as-
javac -classpath _"mcrroot_\toolbox\javabuilder\jar\javabuilder.jar";.\makesqr.jar .\getmagic.java
Note that _mcrroot _is the path to where the MATLAB Runtime is installed on your system. If you have MATLAB installed on your system instead, you can use the path to your MATLAB installation
Verify that javabuilder.jar file exists on the location.