Java launcher in Vista runs app as XP, breaking JFileChooser - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

macinta
Posts: 9
Joined: Thu Jun 07, 2007 8:59 pm
Contact: Website

Java launcher in Vista runs app as XP, breaking JFileChooser

Hello,

I am encountering bugs when running my application using the Java launcher, I think because Vista is running the launcher in XP compatibility mode and the JRE doesn't function properly in that scenario. I discovered the problem because my application opens a JFileChooser when the user attempts to save a file. This results in an exception being thrown when run in the launcher, but it works fine from the command line if I use "java -jar". These Java bugs may be relevant:

http://bugs.sun.com/bugdatabase/view_bu ... id=6449933

http://bugs.sun.com/bugdatabase/view_bu ... id=6474738

If I right click on the launcher and go to "Properties >> Compatibility", there is no indication that any compatibility mode is being used. However, when I run the application using the launcher, I get the following as system properties:

Code: Select all


os.name: Windows XP
os.version: 5.1
sun.os.patch.level: Service Pack 2
java.runtime.version: 1.6.0_01-b06

Running the application from the command line using "java -jar", I get these more accurate properties:

Code: Select all


os.name: Windows Vista
os.version: 6.0
sun.os.patch.level: 
java.runtime.version: 1.6.0_01-b06

Any suggestions? Let me know if I can send you any more details. I am including the stack trace below from attempting to use the JFileChooser from the launcher.

Thanks,
- Tim Macinta

Code: Select all

java.lang.ArrayIndexOutOfBoundsException: 3184
	at sun.awt.shell.Win32ShellFolder2.getFileChooserIcon(Unknown Source)
	at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
	at sun.awt.shell.ShellFolder.get(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$LazyWindowsIcon.createValue(Unknown Source)
	at javax.swing.UIDefaults.getFromHashtable(Unknown Source)
	at javax.swing.UIDefaults.get(Unknown Source)
	at javax.swing.MultiUIDefaults.get(Unknown Source)
	at javax.swing.UIDefaults.getIcon(Unknown Source)
	at javax.swing.UIManager.getIcon(Unknown Source)
	at javax.swing.plaf.basic.BasicFileChooserUI.installIcons(Unknown Source)
	at javax.swing.plaf.basic.BasicFileChooserUI.installDefaults(Unknown Source)
	at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknown Source)
	at javax.swing.JComponent.setUI(Unknown Source)
	at javax.swing.JFileChooser.updateUI(Unknown Source)
	at javax.swing.JFileChooser.setup(Unknown Source)
	at javax.swing.JFileChooser.<init>(Unknown Source)
	at javax.swing.JFileChooser.<init>(Unknown Source)
	at com.thinkingmaps.custom.academic.ui.action.FileBase.saveWorkbookAs(FileBase.java:89)
	at com.thinkingmaps.custom.academic.ui.action.FileSaveAs.doAction(FileSaveAs.java:36)
	at com.thinkingmaps.custom.academic.ui.action.ActionBase.actionPerformed(ActionBase.java:279)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.AbstractButton.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

We cannot reproduce this behavior. So in order to investigate this problem please sent a small test project (AIP + JAR) that reproduces this issue to support at advancedinstaller dot com.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
macinta
Posts: 9
Joined: Thu Jun 07, 2007 8:59 pm
Contact: Website

Hi Gigi,

I figured out the problem, and it's not with the launcher - sorry to have bothered you. I'll explain what the problem was in case you have other customers with similar issues in the future.

At some point I must have installed an application which Vista decided needed to be run in XP compatibility mode (possibly from an older installer which I am trying to upgrade to Advanced Installer from). It was installed at exactly the same path as the application that I am creating an installer for now. Even though I uninstalled the previous application, Vista had created some registry entries indicating that the application needed to be run in XP compatibility mode, and uninstalling did not remove these entries. I believe that these registry entries were being applied to the freshly installed application, even though the Explorer "Properties >> Compatibility" tab indicated that no compatibility mode was being used.

I fixed the problem by removing the offending registry entries. They were underneath:
  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
  • HKEY_USERS\{my_id}\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Persisted
Thanks for the support. I have been quite pleased with Advanced Installer thus far.

Thanks,
- Tim Macinta

Return to “Common Problems”