B4J Tutorial Using Resource Hacker to replace 'OpenJDK Platform' app name and icon

There are a few question threads about using Resource Hacker to make sure that your app name and icon appear everywhere you might want it to such as in the taskbar/Task Manager/File Properties, but I don't think anyone's done a tutorial on using it, or what can be accomplished with it. So I thought this might be useful (My apologies if someone's already done this & I've missed it).

Using the Integrated B4JPackager11 with the #PackagerProperty settings mentioned in step 1 below, the chosen app name and icon will be used for shortcuts & the app executable file itself. But the name 'OpenJDK Platform...' may still appear in some other places along with the Duke, the Java Mascot icon.
E.g.

FileProperties.png
RightClickTaskbar.png
TaskManager.png
TaskManager-services.png


This can be changed as follows using a freely available app named Resource Hacker - http://www.angusj.com/resourcehacker/.

1. Use the Integrated Packager to build you app, remembering to first add the Packager Properties ;
#PackagerProperty: IconFile = ..\icon.ico
#PackagerProperty: ExeName = MyApp

2. From within Resource Hacker open your app's executable file. This is the exe file in the ...\Objects\temp\build\bin\ folder:
AppFile.png


Change the file icon...
3. Once you've opened the app file in Resource Hacker, if you expand the 'Icon Group' folder (double-click) in the TreeView, and select it's child (named '2000 : 0' for me), you'll see that the Java mascot, Duke, icon is currently in use...
RH-Icon.png


4. Select 'Replace Icon' from the 'Action' menu.
5. Click the 'Open file with new icon' button and select your preferred icon (.ico) file...
RH-Icon-Replace.png
,
6. Then click the 'Replace' button...
RH-Icon.png


Replace the file name, description, version etc...
7. Open the 'Version Info' folder (double-click) in the TreeView and select its child (named '1 : 0' for me)...
VersionInfo.png

8. Change the text in here to suit your needs...
VersionInfo.png

9. Important: Click the 'Compile Script' button (the green 'play' button) to implement the text changes.

(I'm not sure that this bit alters anything)...
10. Open the 'Manifest' folder (double-click) in the TreeView, and select its child (named '1 : 1033' for me).
11. Locate the entry 'name="javaw.exe" ', and alter the javaw.exe to your own app exe.
12. Click the 'Compile Script' button (the green 'play' button) again to implement the text changes.

13. Finally, click the Save button and close Resource Hacker.

You should then be able to check the changes you've made, although some don't seem to be implemented until after a PC restart, or after you've created an installation file with Inno Setup and installed your app...
AppFile.png
FileProperties.png
RightClickTaskbar-AfterInnoSetupInstall.png
TaskManager.png
TaskManager-services.png



Notes/Tips:
1. The TreeView needs a double-click to open the folders.
2. After making text changes, you must click the 'Compile Script' button (the green 'play' button) to implement the change.
3. Once all changes have been made, the Save button must also be clicked.
3. These changes should be done before buidling an installation file with Inno Setup.
4. There are parameters that can be set within the Inno Setup script to make similar adjustrments to the installation/uninstall files, see:

I hope this helps someone!
 

Attachments

  • image_2021-12-11_191236.png
    image_2021-12-11_191236.png
    80.1 KB · Views: 101
Last edited:

mcqueccu

Well-Known Member
Licensed User
Even after using the Integrated B4JPackager11, when running your app, Windows may sometimes use the name 'OpenJDK Platform' for it, as well as using the Duke, the Java Mascot icon, rather than your own.

Setting Icon and app name was specified there in the thread Integrated B4jPackager11.

You just need to add those parameters.

1639255690440.png



You can also set icon to different Modules using this code

B4X:
Mainform.Icon = fx.LoadImage(File.DirAssets,"icon.png")
 

Chris2

Active Member
Licensed User
Setting Icon and app name was specified there in the thread Integrated B4jPackager11.

You just need to add those parameters.
Absolutely, but as shown in the first set of screen shots, the name 'OpenJDK...' and the java icon still appear in some places such as in Task Manager and when the app is open and you right-click on the taskbar button. That's where I think Resource Hacker can help.

I've slightly re-worded the opening paragraphs to hopefully make it a bit clearer that the #PackagerProperty settings take care of the main app exe name and icon, and the bits that Resource Hacker can help with.
 
Last edited:

tchart

Well-Known Member
Licensed User
Longtime User
@Chris2 did you know that Resource Hacker can be run via command line?

There are several examples in the help.
 

Chris2

Active Member
Licensed User
@Chris2 did you know that Resource Hacker can be run via command line?

There are several examples in the help.
I did not. Thanks for the heads up @tchart!
I'll have a play with it when I have some spare time and see if I can put a script together to do everything in the tutorial in one shot.
 
Top