// shall I write some keywords here to boost search engine ranking?

Saturday, April 14, 2007

Java Swing Application failed to start in Windows

Symptom:



Java Application with Swing GUI unable to start in server with Microsoft Windows and JRE 1.4.2.



When run in -verbose option, the program hang/stopped at:

......

......

[Loaded sun.awt.windows.WPanelPeer from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded java.awt.peer.WindowPeer from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded sun.awt.windows.WWindowPeer from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded java.awt.peer.FramePeer from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded sun.awt.windows.WFramePeer from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded java.awt.dnd.peer.DragSourceContextPeer from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded sun.awt.dnd.SunDragSourceContextPeer from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded sun.awt.RepaintArea from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded java.awt.event.ActionEvent from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded sun.awt.EmbeddedFrame from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]

[Loaded sun.awt.im.InputMethodWindow from C:\Program Files\Java\j2re1.4.2_04\lib\rt.jar]



Solution:



Run the Java Swing App with -Dsun.java2d.noddraw=true. Example:



java -Dsun.java2d.noddraw=true MySwingApp



Explanation:

DirectX's DirectDraw not working on the server. (Just a server, no reason to have a high end graphic card :p ).



As the directive name implied, -Dsun.java2d.noddraw=true will turnoff the DirectDraw. noddraw means  no DirectDraw.



Resources:



List of undocumented properties to change the behavior of Swing in Suns JVM.





Technorati Tags: , , ,

No comments: