2

We are trying to run a application which is using SWT browser internally. In the SWT browser, we would like to revert all IE-based Browsers to use IE9 compatibility mode by default. This is done using System.setproperty method in the main:

System.setProperty("org.eclipse.swt.browser.IEVersion","9999");

The downgrading of the browser works perfectly if we run the application using the command 'java' but does not work if we use the command 'javaw'. We even tried passing it as argument -Dorg.eclipse.swt.browser.IEVersion=9999, still does not work with javaw.

From Difference between java and javaw, it is apparent that there is no real functional difference.

We also tried to set _JAVA_OPTIONS in the system path, does not help.

is there any other place where we can set this option so that it is used by the javaw.

Community
  • 1
  • 1
Dinesh
  • 311
  • 2
  • 12
  • I doubt that this is actually related to `java` vs `javaw`. What does `System.out.println( "org.eclipse.swt.browser.IEVersion" )` print out if called before creating the Browser widget? – Rüdiger Herrmann Jan 27 '16 at 13:03
  • Irrespective of java or javaw, it prints the value set by System.setProperty. – Dinesh Jan 27 '16 at 13:47
  • How do you know which IE version is used? Did you try http://whichbrowser.net/ to see the actual browser version/mode? You may also want to debug the IE version code (class `ID` follow the `PROPERTY_IEVERSION` constant) to see which version gets chosen. – Rüdiger Herrmann Jan 27 '16 at 14:30
  • using javaw - *Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko* using java - *Mozilla/5.0 (***compatible; MSIE 9.0;*** Windows NT 6.1; WOW64; Trident/7.0)* – Dinesh Jan 28 '16 at 14:14
  • If you read the source code of IE.java, you'll see that SWT changes the registry in `HLKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION` and adds an entry with the name of the executable (javaw/java). and the desired version, The key is removed after the browser is disposed of, but you want want to check its value while the application is running. – Rüdiger Herrmann Jan 28 '16 at 14:26
  • Even when the application is not running there is a version for java and javaw available at `HLKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION`. Interesting is the value for java is 9999 and javaw is 9000. If I manually change the value of javaw to 9999, it works as expected. If I change the value at java to 9000, it doesn't work. It looks like if this value already exists at this location, then the value set using System.setProperty is ignored. – Dinesh Jan 29 '16 at 15:33
  • SWT removes the registry key when the `Display` is disposed of. If however the application terminates unexpectedly, the entry is not removed. Your last statement is probably wrong. According to a comment, the entry is overridden every time. If you debug the `IE.java` code as I suggested earlier you'll find out. – Rüdiger Herrmann Jan 29 '16 at 16:25

0 Answers0