The error dialog looks like the following:
Even though this article is related to IB's TWS Java program it may help you fix the same error that occurs when you run a different Java software application.
Cause of the problem
First of all TWS is a software application written in the Java programming language. It needs the Java runtime environment in order to run.
Right click on the TWS Windows shortcut to examine the actual shortcut. It should be something like this:
C:\Windows\System32\javaw.exe -cp jts.jar;total.2012.jar -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx1024M -XX:MaxPermSize=256M jclient/LoginFrame C:\Jts
When you finish installing TWS on your Windows platform, a Windows shortcut is created automatically which points to C:\Windows\System32\javaw.exe. javaw.exe is the Java runtime environment executable. However if C:\Windows\System32\javaw.exe is incompatible with your computer hardware or with TWS program, you will see this error dialog.
Therefore, the root cause of the problem where system cannot find Java runtime environment is that the installed Java runtime environment is incompatible with your system hardware or with the Java program.
Solution
To fix the error that Windows cannot find Java SE runtime environment, simply download and install the latest JRE from the internet. Once you finish installing JRE on your Windows system, you should see the JRE files in C:\Program Files (x86)\Java.
In my situation I have both jre6 and jre7 folder. Let's go to jre7 -> bin and I see javaw.exe. The complete path to javaw.exe is:
C:\Program Files (x86)\Java\jre7\bin\javaw.exe
I copy it to C:\Windows\System32\ to replace the old javaw.exe and run the TWS shortcut again. And it works!
If you don't know which version of JRE to download, download several of them, and try each one.
Questions? Let me know!