MATLAB Answers

(noob) Matlab Compiler Issue

3 views (last 30 days)
Peter Cook
Peter Cook on 19 Jun 2015
Commented: Peter Cook on 23 Jun 2015
Hey folks,
I am trying to build an m-file (sans GUI) into a standalone application for colleagues to utilize.
Unfortunately, the compiler immediately exits in error when I hit Package. here is the packagingLog:
<mkdir dir="C:\Users\hb69954\Documents\MATLAB\kairos\SugaredOwl\for_redistribution" />
<mkdir dir="C:\Users\hb69954\Documents\MATLAB\kairos\SugaredOwl\for_testing" />
<mkdir dir="C:\Users\hb69954\Documents\MATLAB\kairos\SugaredOwl\for_redistribution_files_only" />
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/Project
at com.mathworks.project.impl.engine.AntEntryPoint.main(
Caused by: java.lang.ClassNotFoundException:
at$ Source)
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
My assumption here is I am missing a java library, could anyone point me in the right direction?

Accepted Answer

Gitesh Nandre
Gitesh Nandre on 22 Jun 2015
Edited: Gitesh Nandre on 22 Jun 2015
The "NoClassDefFoundError" error is thrown because MATLAB is not able to locate Java Runtime libraries that are used by the MATLAB Compiler SDK.
There are several possible causes to this issue:
A. The installation is corrupted and there are .jar files missing from the MATLAB installation folder.
B. The classpath.txt file is missing references to Java Runtime libraries.
1. To take a look at the MATLAB search path, execute "pathtool" in the Command Window. This will open up the Set Path window with the list of folders that MATLAB parses. The start-up folder should be at the top.
You can try to restore the search path to the installation default by executing the following commands:
>> restoredefaultpath
>> rehash toolboxcache
However, this will not remove the start-up directory from the MATLAB search path. If the start-up folder contains M-files, try to remove them or move them to another folder which is not on the search path.
2. If the issue still persists, the installation might be corrupted. Remove MATLAB completely and install it again to resolve the issue.
  1 Comment
Peter Cook
Peter Cook on 23 Jun 2015
A full un-install/re-install fixed the issue. I believe this issue may have been due to not having the correct JDK (Java 1.6.0_60-b19) installed at the time I installed MATLAB R2015a.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by