MATLAB: Do I get a Java exception error when trying to launch the results of a Polyspace Bug Finder project

bugfindererrorjavaexceptionPolyspace Bug Finderpolyspacesetupresults

I'm using R2019a and are following the MathWorks example on using the Polyspace Bug Finder results class, as linked here – https://www.mathworks.com/help/releases/R2019a/bugfinder/ref/polyspace.bugfinderresults-class.html#d117e93609
I receive a Java Exception error occurs at line "bfSummary = proj.Results.getResults('readable');":
———————————————————————————————————-
Error using PolySpaceResult/Initialise
Java exception occurred:
java.lang.NoClassDefFoundError:
com/polyspace/mwsqlite4java/SQLiteException
at
com.polyspace.util.RTEFileParser.getGlobalInformationFromDB(RTEFileParser.java:188)
at
com.polyspace.util.RTEFileParser.parseRTEFile(RTEFileParser.java:133)
at
com.polyspace.util.RTEFileParser.<init>(RTEFileParser.java:52)
at
com.polyspace.util.ReportInterface.ReportInterface.setResultsFolder(ReportInterface.java:284)
at
com.polyspace.util.ReportInterface.ReportInterface.<init>(ReportInterface.java:134)
Caused by:
java.lang.ClassNotFoundException:
com.polyspace.mwsqlite4java.SQLiteException
————————————————————————————————————-
Why do I observe this error, and how do I fix it?

Best Answer

There are two cases where such an error could occur:
- MATLAB was not restarted after calling "polyspacesetup"
OR
- MATLAB release was updated to a new update version and Polyspace was not setup again, i.e. calling "polyspacesetup('uninstall')" and then "polyspacesetup('install')"
To verify this, run the command "javaclasspath" in MATLAB and check if you have a line that says "java/jar/polyspace/mwsqlite4java.jar" in the STATIC java path which was the cause of the error. If you have mwsqlite4java.jar listed in the STATIC java path, then there should be no error. If you do not see this listed, please make sure to set up Polyspace again as mentioned above.