Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 584
Arjit Avatar asked Dec 04 '25 02:12

Arjit


2 Answers

Use the maven-jar-plugin to add the splash screen to your manifest:

<build>
  ...
  <plugins>
    ...
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.6</version>
      <configuration>
        <archive>
          <manifestEntries>
            <SplashScreen-Image>images/cover.png</SplashScreen-Image>
          </manifestEntries>
        </archive>
      </configuration>
    </plugin>
    ...
  </plugins>
  ...
</build>
like image 66
Moose Morals Avatar answered Dec 05 '25 16:12

Moose Morals


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>
  • Plugin Documentation
  • Example
like image 28
Hauke Ingmar Schmidt Avatar answered Dec 05 '25 15:12

Hauke Ingmar Schmidt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!