This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 225014

Summary: Create desktop and startmenu link using the branding icon
Product: installer Reporter: markiewb
Component: NBIAssignee: Libor Fischmeistr <lfischmeistr>
Status: NEW ---    
Severity: normal CC: hardyheroin, markiewb, NeilCSmith, ramis, rharvey
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:

Description markiewb 2013-01-17 10:06:02 UTC
Geertjan describes in https://blogs.oracle.com/geertjan/entry/icons_for_netbeans_platform_applications how to hack the icon-resource in the *.exe file to make it possible to exchange the icon.

I think could be even easier: The nbi-installer could create the *.lnk using a customer defined icon. So no resourcehack in the exe file is necessary. This way the custom icon is seen on the desktop and in the startmenu. The original *.exe stays untouched.

EXPECTED: After installing a NBRCP app, the link on the desktop and in the start menu use the custom branding icon.
Comment 1 dinhosminorfay 2014-04-30 17:26:17 UTC
Hello Netbeans Team,

Any news about this topic?

>>EXPECTED: After installing a NBRCP app, the link on the desktop and in the start >>menu use the custom branding icon.

I am trying to build an installer and I was expecting the same behaviour expected for markiewb.

Regards,
Adriano
Comment 2 hardyheroin 2014-05-26 01:13:34 UTC
I will add myself to the list of developers that would greatly appreciate the implementation of this feature. An application icon is an integral part of branding and should be treated as such.
Comment 3 oyarzun 2014-08-12 18:33:23 UTC
You can do this in the ant build.xml.

    <condition property="isWindows">
	<os family="windows" />
    </condition>
    
    <!-- override build-launcher to replace the icon for the Windows launcher exe. -->
    <target name="build-launchers" depends="suite.build-launchers">            
        <antcall target="replaceWindowsLauncherIcon"/>
    </target>    
    
    <!-- Windows-only target that replaces the icon for the launcher exe with our own icon. -->
    <target name="replaceWindowsLauncherIcon" if="isWindows" description="Replace the icon for the Windows launcher exe">
        <echo message="Replacing icon of Windows launcher executable."/>
        <exec executable="ReplaceVistaIcon.exe" resolveexecutable="true">
            <arg line="build/launcher/bin/${app.name}.exe ${app.name}.ico"/>
        </exec>
    </target>

I actually am doing it a little bit different now since I use OS X as my development platform. I am using IconExe from the eclipse project
to replace the icon since it is cross platform. The only catch is that I need to use an app.exe and app64.exe that has had the icon replaced,
since the ico used to make those files was missing some layers. see https://netbeans.org/bugzilla/show_bug.cgi?id=64612#c12

Ideally app.exe and app64.exe should be fixed and IconExe should be used in the build harness to replace the icon, without having to create 
custom ant build targets.

http://git.eclipse.org/c/equinox/rt.equinox.p2.git/tree/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java
Comment 4 ramis 2015-10-27 03:43:53 UTC
A patch in the way markiewb describes it would be very easy.
The file Netbeans-install-dir\harness\nbi\stub\ext\components\products\helloworld\src\org\mycompany\ConfigurationLogic.java, which is compiled into the installer, already contains the field ICON_WINDOWS. It just points to the app.exe. The user just needs to be able to specify an .ico file which is used here.

Currently I am replacing ConfigurationLogic.java in my NetBeans Platform Application to achieve this.
For Ant based projects, this has to be replaced in the install dir, I think (really ugly) and for Maven based projects, this can be achieved as described here: http://www.mojohaus.org/nbm-maven-plugin/buildinstexample.html.
Comment 5 ramis 2015-10-27 04:12:50 UTC
Patch outline:
- \harness\nbi\stub\ext\components\products\helloworld\src\org\mycompany\ConfigurationLogic.ICON_WINDOWS should point to the app icon from the bundle.properties
- \harness\nbi\stub\template.xml needs to replace the value in bundle.properties

Then the user can specify the icon in their application module's pom through the configuration of the nbm maven plugin:

<groupId>org.codehaus.mojo</groupId>
<artifactId>nbm-maven-plugin</artifactId>
<configuration>
  <userSettings>
    <nbi.windows.icon.file>app.ico</nbi.windows.icon.file>
  </userSettings>
</configuration>

I might provide a patch for this. Can anyone tell me, where this has to be fixed in the NetBeans code base? I found this infrastructure twice: In libs.nbi.ant/stub/ and in nbbuild/harness/nbi/stub/
Which location is the right one or will this have to be changed in both?
Comment 6 markiewb 2015-11-03 20:38:11 UTC
(In reply to ramis from comment #5)
> Patch outline:
> -
> \harness\nbi\stub\ext\components\products\helloworld\src\org\mycompany\Config
> urationLogic.ICON_WINDOWS should point to the app icon from the
> bundle.properties
> - \harness\nbi\stub\template.xml needs to replace the value in
> bundle.properties
> 
> Then the user can specify the icon in their application module's pom through
> the configuration of the nbm maven plugin:
> 
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>nbm-maven-plugin</artifactId>
> <configuration>
>   <userSettings>
>     <nbi.windows.icon.file>app.ico</nbi.windows.icon.file>
>   </userSettings>
> </configuration>
> 
> I might provide a patch for this. Can anyone tell me, where this has to be
> fixed in the NetBeans code base? I found this infrastructure twice: In
> libs.nbi.ant/stub/ and in nbbuild/harness/nbi/stub/
> Which location is the right one or will this have to be changed in both?

@Libor: Can answer these questions and thus help ramis to provide a patch to improve NetBeans platform.