Search code examples
javaswinggtklook-and-feeljnlp

How can I set my Java system look and feel for JNLP apps?


I am running Gnome on OpenSuse. As a result, my system look and feel is GTK+, which has numerous ugly problems (see some of them here).

During development of my swing app, I can run the client from command line or IDE and specify VM parameter

-Dswing.systemlaf=com.sun.javax.swing.plaf.metal.CrossPlatformLookAndFeel

to make it look good.

But I don't know how to force Java Webstart to use this VM parameter when I start the application through JNLP.

edit: This has nothing to do with the programmatic ability to set the look & feel. The application does this properly.

My question is how to tell Java Webstart to use a VM parameter "swing.systemlaf" when it runs the myapp.jnlp file.


Solution

  • Java Web Start allows certain JVM flags to be set with the java-vm-args attribute of the j2se element but you may use

    <property name="key" value="overwritten"/>  
    

    and set properties. it will be available through the System.getProperty and System.setProperties methods

    http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html#resources