This bug has been fixed in Release 2012b (R2012b). For previous product releases, read below for any possible workarounds:
This is a bug in MATLAB Compiler 4.16 (R2012a). Possible workarounds are:
1. Instead of using
import com.google.common.base.Stopwatch;
where the full class name is defined, use
import com.google.common.base.*;
2. It is also possible to encapsulate the IMPORT statements inside MATLAB Class objects, such as:
classdef someclass
methods
function helloworld(obj)
import com.google.common.base.Stopwatch;
disp('Hello, world!');
end
end
end
In this case, you still get the warning
Error: File: T:\1-GOVY7I\repro_import_build_error\repro_import_build_error\standalone_hello.m Line: 2 Column: 8
Arguments to IMPORT must either end with ".*"
or else specify a fully qualified class name: "com.google.common.base.Stopwatch" fails this test.
but the compilation will continue and generate a working component.
3. Add the java class JAR file into MATLAB's static java class path (instead of using JAVAADDPATH, which adds to dynamic class path). To do this, you need to add the JAR file path into MATLAB's classpath.txt file located at
matlabroot\toolbox\local\classpath.txt
where matlabroot is MATLAB's installation directory. Editing the classpath.txt file should be avoided if possible, as any mistake can cause MATLAB to crash upon startup.
Best Answer