Like a program’s icons don’t need to be in a resource folder or something?

Asked

Viewed 34 times

1

I’m using Java, but it’s a very general question, actually.

When I load an image as a program icon (program icon, save icon, click icon, any icon) and change the folder where the icon is, naturally an error occurs because the program looks for the icon in an outdated address.

As a solution, I created a resource folder in the same program project folder, to store the icons I’m using.

Why do programs (such as Word, Adobe File Reader, Solidworks or Autocad, etc.) usually not have, at least apparently, a folder with the icons used in the program? How does this happen?

  • Nothing prevents the resources from being inside the executable itself. There are several ways to do this, which depend on OS, compiler, language etc.

  • Could you give me an example? Or a direction to continue researching this? I think this can make my life easier to load the icons and images of my program.

1 answer

2


A standard executable may have resources inside it in addition to the binary execution code. As you may already know this is called Resources (name on Windows, but can do on Linux also, and in Macos it’s used Bundles).

It can be texts or other data formats, including images of various formats such as icons.

There are some utilities to see what is inside it or manipulate this data (Example, Example, Example). Obviously a Linker allows you to do this maintenance in its most basic form (documentation of Linker microsoft). Ides usually have something to help with that. There’s a way programmatically.

In theory he could do this in Java, but he already has to put other things together, it doesn’t make so much difference to have something like this. What it could do is a mechanism itself creating a array of bytes and play the bytes of the icon on it. There’s not much secret. Then take this array and do as you wish as if you read from a file.

  • I did not understand very well what you said, but I could see that the answer is WELL complete. I liked this last idea of the byte array, I will try to study to do this. Thanks for the links too, will help a lot. Thanks bigown! = D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.