Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Include icon image in JAR file and JAR icons

 
Colin McTaggart
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am developing a small desktop porgram and was wondering if it were possible to include the .ico file I use for my icon image and the .png file I use for my shortcut icon inside the JAR file. I was also wondering if it is possible to change the icon of my JAR file so it uses the .png icon instaid of the default JAVA one, any help would be much appreciated . I use Netbeans IDE to build my JAR file, this is relevant as I am a newbie and I don't know how to make a JAR file except by building in Netbeans :S.
 
Campbell Ritchie
Sheriff
Posts: 48645
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're not used to building jars, this Java™ Tutorials pages (and adjacent pages) may help
You can certainly include image files in the .jar. Don't know about changing the desktop icon, however.
 
Paul Clapham
Sheriff
Pie
Posts: 20945
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Windows you can only change the icon of an executable program. However a JAR file is not an executable any more than an Excel spreadsheet is. (It's java.exe which is the executable and it uses the jar as data, just as the spreadsheet is data used by the Excel.exe executable.)
 
Rob Spoor
Sheriff
Pie
Posts: 20510
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:(It's javaw.exe which is the executable and it uses the jar as data, just as the spreadsheet is data used by the Excel.exe executable.)

There, I fixed it for you.
 
Colin McTaggart
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the gap, I had to put this project on hold for a couple of weeks as my car was written off :S. What I do in windows just now is I have the .ico file in the install directory of my app then I manually make a windows shortcut and change the icon to my .ico. I also have a .png there that I use as my icon image. I plan on writing some code to automatically create this shortcut for me. Is it possible to store one or both of these files in the .JAR file?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic