The fact that I debugged this application already has helped at least one other organization, so rather than forcing everyone to figure this out on their own, I figured I would blog about it.

I worked with a customer who was using MatLab 7.1 R14 SP3. (For the sake of completeness, I’ll also specify that they were running it on Java 1.6.17.) Now, they had the most current version also, which they believed was working on Windows 7. They weren’t trying to avoid an upgrade, and liked the new features. But they were saying that they needed this older version from time to time to process some of their older work. (Apparently data upgrade isn’t as simple? I don’t know the first thing about MatLab – all I know is that I was asked if they could keep it going, and I said I would give it a go.)

When they ran the application, they saw an error message that looked something like this:

clip_image002

This “Error Starting Desktop” message followed by a huge Java stack dump … well, they didn’t find it so helpful.

(Dear fellow developers: please don’t dump stack traces in front of your users.)

What they tried next was a stroke of genius. They put it into Windows 2000 compatibility mode, and it started working. So, when I came in, I had a pretty darn good hint. (This customer was unaware that compatibility modes just use shims, so they were just trying to avoid all of their users from having to manually set this up.) I let them know that they could create a custom shim database to address this. Plus, as long as you’re at it, we could spend a couple of minutes figuring out precisely which shims are actually necessary. We just kept removing shims until it stopped being fixed.

Interestingly enough, the only shim that ended up being actually necessary to fix the application was the Win2000VersionLie shim. That’s right – we didn’t have to actually change anything, we just needed to pretend that we were Windows 2000. (So, apparently, there is some code branch somewhere – either in Java or MatLab – that results in working code being executed on Windows 7 when it thinks it’s running on Windows 2000.)

A little over a month later, I got an email from somebody trying to run MatLab R2006a on Windows 7, and seeing the exact same dialog. I responded (within 2 minutes) “Win2000VersionLie.” so of course he didn’t believe me. So then, I told this person the story and why I thought I knew the answer. Once I did this, he actually had is customer try it.

His response?

“OMG, Chris – This worked!”