josephino josephino - 3 years ago 301
Linux Question

Java -XstartOnFirstThread command line options unrecognized in Linux but working in OSX

I'm using -XstartOnFirstThread argument to solve SWT launch problem in OS X in a Unit test:


Test pass in OSX but fails in Linux with mentioning that -XstartOnFirstThread is Unrecognized:

[/var/local/devtools/jdk1.8.0_141/jre/bin/java, -Dosgi.noShutdown=false,
-Dosgi.os=linux,, -Dosgi.arch=x86_64, -XstartOnFirstThread,
-Dosgi.clean=true, -jar ...

21:22:35 [artifact:mvn] Unrecognized option: -XstartOnFirstThread
21:22:35 [artifact:mvn] Error: Could not create the Java Virtual Machine.
21:22:35 [artifact:mvn] Error: A fatal exception has occurred. Program will exit.

Is there any way to get this working on Linux, or a way to add a condition in tycho to ignore this argument in Linux.

Answer Source

There is a misconception on your end. When you run java -X, you get told:

The -X options are non-standard and subject to change without notice.

In other words: anything that starts with -X is highly implementation specific. And of course, that adds the moment of versioning as well.

Meaning: unless you are using the exact same version of Oracle Java on Linux and on Mac, chances are that anything starting with -X might not work the same way.

In other words: most likely your expectation that this works on both platforms is flawed to begin with.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download