簡體   English   中英

如何在java for mac installer中更改安裝程序的java默認圖標

[英]How to change java default icon of installer in java for mac installer

我有javafx應用程序,我已經成功創建了應用程序的安裝程序,但我想更改安裝程序的java默認圖標,所以我在pom.xml中添加了$ {basedir} /src/main/resources/images/logoIcon.ico但它不能改變,

pom.xml的整個快照如下:

http://maven.apache.org/xsd/maven-4.0.0.xsd“>

<modelVersion>4.0.0</modelVersion>

<groupId>com.testDemo</groupId>
<artifactId>test-app</artifactId>
<name>demo-app</name>

<packaging>jar</packaging>
<version>1.0</version>

<organization>
    <!-- Used as the 'Vendor' for JNLP generation -->
    <name>testDemo</name>
</organization>

<properties>
    <slf4j.version>1.6.1</slf4j.version>
    <springframework.version>3.2.2.RELEASE</springframework.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>com.zenjava</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>1.5</version>
            <configuration>

                <mainClass>com.testdemo.testapp.testApplication</mainClass>

                <!-- only required if signing the jar file -->
                <keyStoreAlias>example-user</keyStoreAlias>
                <keyStorePassword>example-password</keyStorePassword>
                <permissions>
                    <permission>all-permissions</permission>
                </permissions>
                <icon>${basedir}/src/main/resources/images/logoIcon.ico</icon>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>

    </plugins>
</build>


<dependencies>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${springframework.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${springframework.version}</version>
    </dependency>

    <dependency>
        <groupId>com.miglayout</groupId>
        <artifactId>miglayout-javafx</artifactId>
        <version>4.2</version>
    </dependency>

    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.2</version>
    </dependency>

    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils-core</artifactId>
        <version>1.8.3</version>
    </dependency>

    <dependency>
        <groupId>com.javadocmd</groupId>
        <artifactId>simplelatlng</artifactId>
        <version>RELEASE</version>
    </dependency>

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.2.7</version>
    </dependency>

    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.6</version>
    </dependency>

    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20090211</version>
    </dependency>

</dependencies>

為了創建包,我使用以下命令,

  1. mvn jfx:build-jar(它只提供jar應用程序)
  2. mvn jfx:build-native(它給出了應用程序的.dmg文件)

所以請建議我,如何更改mac的默認安裝程序圖標。

我在那里添加了src / main / deploy / package / macosx / myapp.ico,它終於工作了:)

為了你:

創建src / main / deploy / package / macosx /文件夾添加名稱為$ {project.build.finalName} .ico的圖標運行mvn jfx:build-native我沒有廣泛使用它 - 只是讓它工作並想要分享。 所以如果你想使用不同名稱的圖標,我不知道如何。 至少還沒有。 配置部分中的...部分似乎是針對webstart的,所以我沒有使用它。 希望你能開始工作!

如何在Windows上為javafx本機程序包圖標設置自定義圖標

快速查看源代碼會讓我覺得圖標不能在子目錄中(這似乎是一個bug)。

作為一種解決方法,您可以嘗試將logoIcon.ico移動logoIcon.ico一個目錄上(在src/main/resources

如果它不起作用,你也可以嘗試將它放在src/main/deploy/ (而不是在子目錄中)

要調試它,您還可以使用-X選項運行maven並查找日志:

Using icon file at ...

要小心這個日志,因為它可能會打印正確的路徑,而似乎只有文件名將用於解析圖標(即子目錄將被忽略)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM