Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to change the default icon of a shortcut file on Mac using Java

 
Lucky Dhar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String[] cmd = { "ln" "s" ,"sourcePath " ,"destPath" };

try{
Runtime.getRuntime().exec(cmd);
}
catch(IOException y){
System.out.println("Error"+y.getMessage())

I have created a Shortcut using the above code in Mac.
I need to change the default icon of shortcut created .I need to do it using Java.

Thanks
Lucky
 
Lucky Dhar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to change the icon image of shortcut created.

It needs to be implemented in java.

Thanks
Lucky
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just googled a bit for this and to me it seems like you'd need to bundle your Java application like a native OS X application and include a plist file that defines the icon to use. This thread also seemed potentially useful.
 
Lucky Dhar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

In my Swing Application,i have created a shortcut to a pdf file on button click .
Now the problem is that it is showing the default icon of Pdf .

I want to change this default Pdf icon and specify my own icon image.

I have used the following code to create a shortcut to a pdf file.

String[] cmd = { "ln", "-s", "/Users/abc/Documents/new.pdf" , "/Users/abc/Desktop/test.pdf" };

Try{
Runtime.getRuntime().exec(cmd)
}
catch(IOException y){
System.out.println("Error"+y.getMessage());

}
I want to change the icon image of pdf shortcut created on button click.


Thanks
Lucky
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add code tags by clicking the .
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lucky, you can continue asking the same question here again and again but that won't change the answers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic