3

We have a netbeans-platform application, that creates a custom runnable .exe with the default NetBeans icon - as you can guess, when customers install it, they are not happy.

This NetBeans Wiki article and this NetBeans Bug (closed as wontfix) indicate that the platform can't do it natively, and suggest the use of a third-party executable to do it.

However, having a binary executable in our svn repo being called by maven during build time leaves me (and my boss) quite unhappy.

Is there a library in Java, preferably available in maven, that can change the icon an .exe file uses?

EDIT: Upon further research, I found this SO question... that wasn't answered either.

EDIT2: We are also not looking for another packager that can create an .exe for us. We are happy with the default NetBeans' Platform one, and it's already quite well integrated with our dev/release cycle.

Community
  • 1
  • 1
Marcelo
  • 4,580
  • 7
  • 29
  • 46
  • You have to understand that the icon only makes sense in a .exe context, it has nothing to do with Java; you should investigate the various ways available to you to generate a windows executable to wrap around your jars and in which ways they are customizable. – Viruzzo Feb 28 '12 at 15:21
  • @Viruzzo, I know it only makes sense in a exe/Windows context - the windows executable is already being generated by the NetBeans platform, and is already integrated into our build cycle. However, Portable Executables (PE) manipulation can be done with any language, so I'd say its quite reasonable to expect a Java lib that does it to exist (as Delphi, C#, etc exist). – Marcelo Feb 28 '12 at 15:28
  • Fair enough, still it seems better to me to use another exe generation tool that to try to work around an inefficient one, especially since there is no magic to it, much less in NetBeans's one. Also it seems cleaner to separate your build process from your IDE. – Viruzzo Feb 28 '12 at 16:09
  • @Viruzzo Please notice we are talking about the NetBeans Platform here, not about using NetBeans as an IDE to some project. – Marcelo Mar 05 '12 at 13:39
  • Check this answer [including an icon into a self-contained JavaFX application (.exe)](https://stackoverflow.com/questions/13683335/including-an-icon-into-a-self-contained-javafx-application-exe) – Led Machine Sep 27 '17 at 15:48

3 Answers3

1

If you are already using maven you might use launch4j for creating an .exe. There is a maven plugin available. You also might take a look at this netbeans plugin.

vchuravy
  • 1,208
  • 10
  • 22
1

It's not a library that accomplishes what you want, but the closest I could find was this - it'll read PE files and it's open source and Java. You may be able to look through the source to find the code that you need.

Michael Berry
  • 70,193
  • 21
  • 157
  • 216
0

Is there a reason you're not simply calling Window.setIconImages() on startup, and loading some images, possibly stored right within the JAR?

Thorn G
  • 12,620
  • 2
  • 44
  • 56
  • 1
    We are doing that, but it only sets the image on the current Window/Frame - but the executable still has no icon, so when it's seen on Windows Explorer, you get the default NetBeans one... same if the user decides to create a shortcut, it will use the icon on the `.exe`. – Marcelo Mar 05 '12 at 14:28
  • Ah, I see -- I misunderstood what you're shooting for. In that case, you might have to use something like Launch4J to build your EXE instead, as others have suggested. – Thorn G Mar 05 '12 at 14:30