Search code examples
javamavenlaunch4j

Launch4j Maven integration: Pass VM arguments (-XX:CompileCommand)


We encountered a JIT Bug in Java 8 in conjunction with a specific swing method. LINK. Now we have to disable the JIT for this specific method as a vm argument in launch4j but I don't seem to be able to pass this vm argument to launch4j in maven. I have the following maven declaration:

        <plugin>
            <groupId>org.bluestemsoftware.open.maven.plugin</groupId>
            <artifactId>launch4j-plugin</artifactId>
            <version>1.5.0.0</version>
            <executions>
                <!-- GUI exe -->
                <execution>
                    <id>l4j-gui</id>
                    <phase>package</phase>
                    <goals>
                        <goal>launch4j</goal>
                    </goals>
                    <configuration>
                        <headerType>gui</headerType>
                        <outfile>target/Launcher_${version}.exe</outfile>
                        <jar>target/${jar.file.withDependencies.name}</jar>
                        <errTitle>Error Title</errTitle>
                        <icon>src/main/resources/icon/icon.ico</icon>
                        <jre>
                            <minVersion>1.7.0</minVersion>
                            <initialHeapSize>128</initialHeapSize>
                            <maxHeapSize>900</maxHeapSize>

                             <!-- Doesn't work... -->
                            <!--<opt>-OmitStackTraceInFastThrow</opt>-->

                        </jre>
                        <versonInfo>
                            <fileVersion>1.0.0.0</fileVersion>
                        </versionInfo>
                    </configuration>
                </execution>
            </executions>
        </plugin>

Solution

  • You should encapusalte the opt elements inside and opt tag.

    In your case, inside the jre tag:

    <opts> <opt>-OmitStackTraceInFastThrow</opt> </opts>