简体   繁体   中英

How to change Javafx default app image/icon/thumb

I developed a javafx application. I want to change the java default icon of .jar file. I tried this primaryStage.getIcons().add(icon);

but this only make change the left top corner icon when running the app not the external view image.

screenshot below: http://i.stack.imgur.com/GoShA.png I want to change this icon actually.

All Jar files have the same icon and it depends on the OS to show an icon on a file depending on the file type.

primaryStage.getIcons().add(icon);

The above line will only get executed when a JVM is created for the application, so it doesn't make sense to depend on this particular piece code to display an icon :)

If you want to change the file icon, you will have to wrap the executable jar file to create a new native executable file (which depends on the OS). For example - EXE for windows. This new file will contain the image file to be displayed and the jar to be executed.

You can try using Launch4j or JSmooth for creating a wrapper file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM