How do the icons in a program need not be in a resource folder or something?

1

I'm using Java, but it's a pretty general question indeed.

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

As a workaround, I created a resource folder in the same folder as the program project to store the icons I'm using.

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

    
asked by anonymous 31.08.2016 / 02:00

1 answer

1

A default executable can have resources inside it in addition to the binary runtime code. As you may know this is called resources (name in Windows, but you can do in Linux , and in MAC OS it is used bundles ).

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

There are some utilities to see what's inside it or to manipulate this data ( Example , Example , Example ). Obviously a linker allows you to do this maintenance in its most basic ( > linker from Microsoft ). IDEs tend to have something that helps. You have to programmatically .

In thesis could do this in Java, but it already has to gather other things, it does not make so much difference to have something like that. What you could do is create your own array and bytes of the icon in it. There is not much secret. Then you get this array and do whatever you want as if you had read from a file.

    
31.08.2016 / 02:21