Setting system properties in Groovy

Viewed 14749

Please note: Although I mention Swing and MacOS here, this question has nothing to do with either of them: I'm just providing them as a concrete example of what I'm trying to do.


I'm trying to set a system property the groovy way. If you are developing a Swing app on a Mac, it is common practice to set the following system property so that your Swing app's menu looks the same as typical Mac apps:

System.setProperty("apple.laf.useScreenMenuBar", "true")

When I call that inside my main method, it has the desired effect (the menu bar gets pulled off of the JFrame and is pinned to the top of the screen).

But when I go to try and make that call groovier:

System.properties['apple.laf.useScreenMenuBar', 'true']

it doesn't work. No exceptions, it just stops working and doesn't have the desired effect in the UI. Why, and what can I do to fix it?

1 Answers
Related