B4J Question B4J V 8.30 Error compiling icon.png

Jeanc161

Member
Licensed User
Longtime User
Since the Build Executable project is new in B4J and i don't know much about it, maybe someone could help me

I Use the B4J 8.30 Final version, and set it up to use the jdk 14, not the 11, it give me more problems to compile, so i downloaded the jdk V 14 and all it's components and this part seem to be working correctly, Even now i can build the executable and it does not pop me with the javaFx.swing not found or other problems that i have before i downloaded the JDK 14 it goes all the way to the conversion of the icon, wich gime me this error...

c:\myProject\Objects\temp\build\myProject.exe: error CS1567: Error generating Win32 resource: Error reading icon 'c:\myProject\Objects\temp\icon.ico' -- The data is invalid.

It seems that it is the compiler that create this file in the temp directory, cause i delete it, and the compiler recreate it each time,
I try several formats for the original icon.png located in Files/Icon.png.

Originally i use a png file with all the colors palette 67Millions, with a dimension of 512x512px, wich display fine in the app.

I try to change the palette to 256 colors with GIMP 2.0 and with a dimension of 72x72px and a pixel ration of 96pxin (Pixel per Inch) and no avail, still jam to that process of compiling the final exe. It goes all the way to this and stop compiling by returning that error.

So i don't know if this have append to someone else, and you do know the solution to this, Do i have to set the icon to a specific size, color depth and so forth, so the app will compile with the Microsoft compiler C#.

Please Help !!!! Thanks
 

Jeanc161

Member
Licensed User
Longtime User
I Think i found the problem, I rebuild the icon.png file using GIMP 2.0, But first i use an utility online to convert the original png to ico file, Then i reload the downloaded myProgram.ico into GIMP, then export that ico to a png file keeping all the image settings in 256x256 pixel using 300dpi x 300dpi in 32bit RGB with no Palette, export that file to a new png renaming that file to myProgram-icon.png and save it.

Then i delete the old icon from the files directory, use the add files to get the newly created png file (myProgram-icon.png) into the files directory so it could be included in the .jar, rename that file to icon.png and then compile everything in release mode to see if it load the icon.

After verifying everything, i use the Internal builder and compile succesfully to an exe in the temp/build dir, seem to be working fine now.

So be advised the icon format is important for the Window c# compiler to create the Window ressource file (icon) to the right format and output the desired executable

Now it works fine.

Thanks anyway and hopefully if someone have the same problem , the solution is here...
 
Upvote 0
Top