'Pass VM Argument in IntelliJ

My main() method that creates instances of my Game Class and GUI class (implementing a board game) and passes that to a new Thread:

new Thread(new Game(gui, args)).start();

Running it gives me the following error

WARNING: Display must be created on main thread due to Cocoa restrictions. Use vmarg -XstartOnFirstThread 
Exception in thread "main" org.eclipse.swt.SWTException: Invalid thread access

Now, I am not sure how to pass the Virtual Machine Argument -XstartOnFirstThread in IntelliJ.

I tried copying the argument into debug configurations but that doesn't seem to work.

enter image description here



Solution 1:[1]

You can put the argument in the box that would normally be labeled VM options.

In your screen shot you have -cp bohnanza-demo

So just add the argument after it. Final should be -cp bohnanza-demo -XstartOnFirstThread

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Klouddy