Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
573 views
in Technique[技术] by (71.8m points)

installation - including an icon into a self-contained JavaFX application (.exe)

Followed the instructions here and here. I am using JDK 7u9 and NetBeans 7.2.1. What I did was create the whole path relative to my project's root folder (C:UsersAdministratorDesktopicotestpackagewindowsicotest.ico). I tried both with a 48x48 and a 256x256 size. Here's a tree overview for my project called icotest:

│   build.xml
│   manifest.mf
│
├───build
│   │   built-jar.properties
│   │
│   ├───classes
│   │   └───icotest
│   │           Main$1.class
│   │           Main.class
│   │
│   ├───empty
│   └───generated-sources
│       └───ap-source-output
├───dist
│   │   icotest.html
│   │   icotest.jar
│   │   icotest.jnlp
│   │
│   └───web-files
│           dtjava.js
│           error.png
│           get_java.png
│           get_javafx.png
│           javafx-chrome.png
│           javafx-loading-100x100.gif
│           javafx-loading-25x25.gif
│           upgrade_java.png
│           upgrade_javafx.png
│
├───nbproject
│   │   build-impl.xml
│   │   genfiles.properties
│   │   jfx-impl.xml
│   │   project.properties
│   │   project.xml
│   │
│   ├───configs
│   │       Run_as_WebStart.properties
│   │       Run_in_Browser.properties
│   │
│   └───private
│       │   private.properties
│       │   private.xml
│       │
│       └───configs
│               Run_as_WebStart.properties
│               Run_in_Browser.properties
│
├───package
│   └───windows
│           icotest.ico
│
└───src
    └───icotest
            Main.java

This is what build.xml looks like:

<target name="-post-jfx-deploy">
    <fx:deploy verbose="true" nativeBundles="exe" outdir="${basedir}/${dist.dir}" outfile="${application.title}">
        <fx:application name="${application.title}" mainClass="${javafx.main.class}"/>
        <fx:resources>
            <fx:fileset dir="${basedir}/${dist.dir}" includes="*.jar"/>
            <fx:fileset dir="${basedir}/${dist.dir}" includes="lib/*.jar"/>
        </fx:resources>
        <fx:info title="${application.title}" vendor="${application.vendor}"/>
        <fx:preferences shortcut="true"/>
    </fx:deploy>
</target>

No matter what I do - I still get this message during the dist build process (that activates ISS) with the debug flag set to true in the according build.xml file: "Using default package resource [application icon] (add package/windows/icotest.ico to the class path to customize)"

Any idea what I might be doing wrong? Thank you.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After trial and error and using XXL answer i post a more clear way of adding your custom icon into a JavaFX self contained. By the way am using Netbeans 7.3 JDK 1.7u17 1. Begin with creating a folder named package inside the folder(has the same name as your project) found in your project src directory.

win 2. under the folder package, create the folder windows and this is where you will place your custom icon.please ensure the name of your .ico file is the same as the application name enter image description here Note: this could have easily be done in netbeans by creating a new package but for some reason, netbeans does not allow your to name a new package 'package' enter image description here

  1. Next your add the directory containing /package/windows/.ico to Ant clathpath properties enter image description here
  2. Clean & Build your project and the final output will look something like this with your custom icon enter image description here

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...