Java application wrapped runs faster on Windows 7 in Windows XP Compatibility mode

java, windows-7-x64

Solution

No definite answer but just a way to diagnose on site what is happening exactly.

You have to be confirm which process is consuming CPU and what it is doing exactly, for instance by monitoring system calls done: the sysinternals tools like Process Explorer and Process Monitor should lead to clues about what may be wrong. At least, you may compare execution profile with versus without XP compatibility mode.

As the problem may come from the Java application itself, you should give a try of a JVM profiling with tools like Netbeans Profiler. Maybe the code relies on some old Windows XP specific stuff like directory structure or environment variable that no longer exist or have changed in Windows 7 (but you kept/reapplied on your own installation)... leading to an improper error handling and infinite loop of retries for instance.

A native windows profiler may be an option too but it is far too difficult to analyze without JVM source code, and when Java code is concerned because of JIT.

Problem

Java application runs faster on Windows 7 in Windows XP compatibility mode according to some of my customers, but why ? I dont seem to have the problem myself, yet they find the application seems to be consuming 100% cpu whilst doing nothing, simply setting the properties of either the exe or a batch file that calls the java to Windows XP compatibility mode fixes it , how could that be ?

Original source