How to change java application default icon on mac using netbeans?

I have a Java application that will need to be deployed on both windows and mac. On Windows, I configured the system to use the .png file as an icon for the application, but for the Mac, the icns file is required. I created the icns file, but I cannot figure out how to set it as an icon for the application (in the dock, export, etc.). I also need the PC side to ignore this icon assignment.

How can I do this in netbeans?

EDIT: I added this line to my build.xml file, according to this link :

<property name="app.icon.icns" value="${dist.dir}/Mac64/yellowMac.icns"/>

and the yellowMac.icns file is in the same directory as the .jar file, but not happy.

+3
source share
5 answers

//For Microsoft Windows
setIconImage(new ImageIcon("Football.png").getImage());
//For Mac OS X
Application.getApplication().setDockIconImage(new ImageIcon("Football.png").getImage());
+1

, Java WebStart JNLP Mac, .

0

Netbeans 8.0.2 .icns Mac OS X, Netbeans DMG.

, .icns Mac OS X.

...

  • Splash Image:...
  • () .icns :.
  • OK s.

  • Choose Package AsDMG Image

Wait for a while until the BUILD SUCCESSFUL message appears. The .dmg file will be located in the dist / bundles directory.

0
source

I managed to add a line to the file nbproject/project.properties:

app.icon.icns=yellowMac.icns

When creating the Mac OSX installer, this icns file was correctly copied to .app.

0
source

if anyone encounters this problem try this

<property name="deploy.icon.native" value="p.icns"/>

where p.icns is inside the project base directory

0
source

Source: https://habr.com/ru/post/1791848/


All Articles