编程语言
首页 > 编程语言> > 如何在Mac的Java安装程序中更改安装程序的Java默认图标

如何在Mac的Java安装程序中更改安装程序的Java默认图标

作者:互联网

我有javafx应用程序,我已经成功创建了应用程序的安装程序,但是我想更改安装程序的java默认图标,所以我添加了
${basedir} /src/main/resources/images/logoIcon.ico
在pom.xml中,但无法更改,

pom.xml的整个快照如下:

http://maven.apache.org/xsd/maven-4.0.0.xsd\”\u0026gt;

<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>

为了创建包,我使用以下命令,

> mvn jfx:build-jar(仅提供应用程序的jar)
> mvn jfx:build-native(给出应用程序的.dmg文件)

因此,建议我如何更改Mac的默认安装程序图标.

解决方法:

快速浏览一下source code,让我认为该图标不能位于子目录中(这似乎是一个错误).

解决方法是,您可以尝试将logoIcon.ico向上移动一个目录(在src / main / resources中)

如果它不起作用,您也可以尝试将其放在src / main / deploy /中(而不是在子目录中)

要调试它,您还可以使用-X选项运行maven并查找日志:

在…使用图标文件

但请谨慎使用此日志,因为它可能会打印正确的路径,而似乎仅使用文件名来解析图标(即,将忽略sub dirs)

标签:javafx,maven,maven-plugin,pom-xml,java
来源: https://codeday.me/bug/20191031/1972740.html