Search code examples
javamavensplash-screen

Splash screen in Java maven project


I am trying to get a splash screen in my project. In eclipses I have found a solution to put VM arguments -splash:src/main/resources/images/cover.png But where do i put this arguments while running a project through maven command line.


Solution

  • exec:java runs the application in the same Java process as Maven so a JVM splash screen is not possible.

    If you use exec:exec you can start a separate Java process and provide arguments to this in the plugin configuration, e.g.:

    <build><plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <configuration>
            <executable>java</executable>
            <arguments>
                <argument>-splash:src/main/resources/images/cover.png</argument>
                <argument>-classpath</argument>
                <classpath />
                <argument>com.company.MainClass</argument>
            </arguments>
        </configuration>
    </plugin>
    </plugins></build>