Main Content

Set Java Properties

Set Java System Properties

Set Java® system properties in one of two ways:

  • In the Java statement. Use the syntax: java -Dpropertyname=value, where propertyname is the name of the Java system property you want to set and value is the value to which you want the property set.

  • In the Java code. Insert the following statement in your Java code near the top of the main function, before you initialize any Java classes:

    System.setProperty(key,value)
    key is the name of the Java system property you want to set, and value is the value to which you want the property set.

Ensure a Consistent GUI Appearance

After developing your initial GUI using the MATLAB® Compiler SDK™ product, subsequent GUIs that you develop may inherit properties of the MATLAB GUI, rather than properties of your initial design. To preserve your original look and feel, set the mathworks.DisableSetLookAndFeel Java system property to true.

Setting DisableSetLookAndFeel

The following are examples of how to set mathworks.DisableSetLookAndFeel using the techniques in Set Java System Properties:

  • In the java statement:

    java -classpath X:/mypath/tomy/javabuilder.jar -Dmathworks.DisableSetLookAndFeel=true

  • In the Java code:

    Class A {
    main () {
             System.getProperties().set("mathworks.DisableSetLookAndFeel","true");
    			      foo f = newFoo();
     	        }
             }