MATLAB: MATLAB cannot find path

MATLABpath

Hi folks
I work as a sysadmin, and a user came to me with a very peculiar problem. He installed MATLAB once, found something wrong, and reinstalled on top of the old MATLAB without uninstalling the earlier version. Now, when he runs MATLAB, he gets the following stream of errors:
Warning: C:\Program Files\MATLAB\R2012a\toolbox\local\pathdef.m not found.
Toolbox Path Cache is not being used. Type 'help toolbox_path_cache'
for more info
Undefined function or variable 'ispc'.
Warning: MATLAB did not appear to successfully set the search path. To
recover for this session of MATLAB, type
"restoredefaultpath;matlabrc". To find out how to avoid this warning
the next time you start MATLAB, type "docsearch problem path" after
recovering for this session.
Warning: Duplicate directory name: C:\Program Files\MATLAB\R2012a\toolbox\local.
Warning: Initializing Handle Graphics failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup,
which should be resolved as soon as possible. Error detected was:
MATLAB:undefinedVarOrClass
Undefined variable "graphics" or class "graphics.internal.initializeMATLABRoot".
Warning: Initializing Java preferences failed in matlabrc.
This indicates a potentially serious problem in your MATLAB setup,
which should be resolved as soon as possible. Error detected was:
MATLAB:UndefinedFunction
Undefined function 'usejava' for input arguments of type 'char'.
> In matlabrc at 113
Warning: Failed to add default profiler filters.
> In matlabrc at 168
Importantly, whenever he calls a function, MATLAB throws up an error. I tried restoredefaultpath and again got a warning:
Warning: Duplicate directory name: C:\Program
Files\MATLAB\R2012a\toolbox\shared\hdlshared.
> In restoredefaultpath at 47
After this, I tried to safely uninstall his MATLAB and reinstall. I tried uninstalling from Control Panel, but it said that MATLAB did not exist. Then, I ran uninstall.exe and was told that java_launcher.dll is missing. When I googled for that, I only found comments from torrent sites. This guy got his copy from the University, so I assume it's legit and that the installation file works.
Does anyone know how I can: 1. Remove his MATLAB and reinstall a fresh copy safely; or 2. Get his MATLAB to work

Best Answer

A standard procedure, if the installation failed such that the de-installation is not successful:
  1. Install on top or damaged program again
  2. A restart might be helpful
  3. Uninstall
  4. A restart might be helpful
  5. Install
Yes, I know that this procedure produced the problem. But I suggest to try it again, because the reinstallation should write all files required for a deinstallation.