如何在Windows上为javafx本机程序包图标设置自定义图标 [英] How to set custom icon for javafx native package icon on Windows

查看:1139
本文介绍了如何在Windows上为javafx本机程序包图标设置自定义图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在创建javafx打包的本机捆绑时删除exe文件的图标。
我尝试将图标添加到pom.xml中,但直到它不会为我工作,因为它提供了默认图标

使用Intellij IDEA IDE,其中包含一个Pom.xml,通过<$ c $创建一个包c> command = mvn jfx:build-native
这是我的 pom.xml

I am trying to chance the icon of the exe file while creating native bundling of javafx packaging. I tried adding icon into pom.xml but till it wont work out for me as it gives default icon
Using Intellij IDEA IDE which contain an Pom.xml creating an package by command = mvn jfx:build-native Here is my pom.xml:

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

                <mainClass>com.demoApp.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>

我在pom.xml $ {basedir} / src / main / resources /中添加了一个图标路径images / logoIcon.ico
将在本机程序包执行时运行,但它不适用于我

I have added an icon path into pom.xml ${basedir}/src/main/resources/images/logoIcon.ico that will run while native package execute but it wont work out for me

还有其他方法吗?
请建议。

Is any other way to do it ? Please suggest.

我在pom.xml中使用ant尝试fx标签,这是我在pom中的更改.xml

i tried fx tags in pom.xml using ant,here is my changes in pom.xml

<properties>

<javafx.tools.ant.jar>${env.JAVA_HOME}\lib\ant-javafx.jar</javafx.tools.ant.jar> </properties>


<plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <id>create-launcher-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target xmlns:fx="javafx:com.sun.javafx.tools.ant">
                                <taskdef
                                        uri="javafx:com.sun.javafx.tools.ant"
                                        resource="com/sun/javafx/tools/ant/antlib.xml"
                                        classpath="${javafx.tools.ant.jar}"/>
                                <fx:application id="fxApp"
                                                name="${project.name}"
                                                mainClass="com.precisionhawk.flightplanner.FlightPlannerApp"/>
                                <fx:jar destfile="${project.build.directory}/${project.build.finalName}-launcher">
                                    <fx:application refid="fxApp"/>
                                    <fx:fileset dir="${project.build.directory}/classes"/>
                                </fx:jar>
                                <attachartifact file="${project.build.directory}/${project.build.finalName}-launcher.jar"
                                                classifier="launcher"/>
                                <fx:deploy>
                                    <fx:info>
                                        <fx:icon href="${basedir}/src/main/deploy/logoIcon.ico"></fx:icon>
                                    </fx:info>

                                </fx:deploy>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

但它无法解决..

推荐答案

我只是使用Zonsky的优秀javafx-maven-plugin来解决同样的问题。从您使用的1.5版本开始,src / main / deploy目录将添加到类路径中。你想要使用的图标可以在那里添加,它将在本机构建器的类路径中可用!

I just struggled with the same issue using Zonsky's great javafx-maven-plugin. As of version 1.5, which you also were using, the src/main/deploy directory will be added to the classpath. The icon you want to use could be added there and it will be available on the classpath for the native builder!

我添加了src / main / deploy / package / windows / myapp.ico那里终于工作了:))

I added src/main/deploy/package/windows/myapp.ico there and it finally worked :)

对你来说:


  1. 创建 src / main / deploy / package / windows / 文件夹

  2. 添加名称为 $ {project。 build.finalName} .ico

  3. 运行 mvn jfx:build-native

  1. Create src/main/deploy/package/windows/ folder
  2. Add icon with name ${project.build.finalName}.ico
  3. Run mvn jfx:build-native

我没有广泛使用它 - 只是让它工作并想分享。所以如果你想使用不同名称的图标,我不知道如何。至少还没有。配置部分中的< icon> ...< / icon> 部分似乎适用于webstart,因此我一直没有使用它。
希望你能开始工作!

I haven't played with it extensively - just got it to work and wanted to share. So if you want to use icon with different name, I don't know how. Not yet at least. The <icon>...</icon> section in the config section seems to be for webstart, so I haven't been using it. Hope you get it to work!

这篇关于如何在Windows上为javafx本机程序包图标设置自定义图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆