LWJGL Forum

Programming => General Java Game Development => Topic started by: orange451 on March 26, 2017, 00:43:19

Title: Bypass -XStartOnFirstThread?
Post by: orange451 on March 26, 2017, 00:43:19
Was wondering if there was any way to bypass -XStartOnFirstThread. It's terribly inconvenient to have to specify this to run lwjgl applications on OSX.

I totally get that when you release a finished product, you can simply create a "application" under OSX, and specify your JVM arguments there, but when developing it's quite annoying.
Title: Re: Bypass -XStartOnFirstThread?
Post by: Kai on March 26, 2017, 10:56:18
If you are using an IDE, then you can specify default VM arguments. In Eclipse you can do that on a per-JDK basis so that every run configuration you create that uses this JDK will have automatically the VM arguments appended to every run. In IntelliJ IDEA you can do the same on a per-runtype basis. See:
- For Eclipse: http://stackoverflow.com/questions/10639322/how-can-i-specify-the-default-jvm-arguments-for-programs-i-run-from-eclipse#answer-11300970 (the answer from Alice Young, not the one below that)
- For IntelliJ IDEA: https://www.jetbrains.com/help/idea/2017.1/changing-run-debug-configuration-defaults.html
Title: Re: Bypass -XStartOnFirstThread?
Post by: orange451 on March 27, 2017, 02:54:21
Thanks for the response. Is a great fix for IDE-development!

However if I want to compile a quick demo for a friend, I also need to include a file to specifically call those VM functions. Which if he's on a mac he needs to go through terminal to give the sh file permissions to run. Whole thing is a huge hassle.
Title: Re: Bypass -XStartOnFirstThread?
Post by: Cornix on March 27, 2017, 07:44:58
There is not much the LWJGL devs can do about that. Thats how macs work.
Title: Re: Bypass -XStartOnFirstThread?
Post by: darkyellow on March 27, 2017, 13:20:01
Maybe write a java programming which uses Runtime.exec() to call another java class with the desired arts and it can check which is you are on at the same time.

Example jar file has main1.class and main2.class with the manifest having main1 as the class to run when running from a jar directly. Main1 can then run main2
Title: Re: Bypass -XStartOnFirstThread?
Post by: kappa on March 27, 2017, 13:43:35
I posted a code snippet a while back that you can use, if you want to trigger -XStartOnFirstThread programmatically (through Java code), it can be found here. (http://www.java-gaming.org/topics/starting-jvm-on-mac-with-xstartonfirstthread-programmatically/37697/view.html)

Useful if you want to just have a jar that you click to start your app on Mac's without having to manually enter the vm parameter.
Title: Re: Bypass -XStartOnFirstThread?
Post by: orange451 on March 27, 2017, 16:48:28
Quote from: kappa on March 27, 2017, 13:43:35
I posted a code snippet a while back that you can use, if you want to trigger -XStartOnFirstThread programmatically (through Java code), it can be found here. (http://www.java-gaming.org/topics/starting-jvm-on-mac-with-xstartonfirstthread-programmatically/37697/view.html)

Useful if you want to just have a jar that you click to start your app on Mac's without having to manually enter the vm parameter.
Works fantastically. Thanks!