wood burning stoves 2.0*
The moose likes Mac OS and the fly likes How to change the default icon of a shortcut file on Mac using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "How to change the default icon of a shortcut file on Mac using Java" Watch "How to change the default icon of a shortcut file on Mac using Java" New topic
Author

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

Lucky Dhar
Greenhorn

Joined: Jul 02, 2008
Posts: 7
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

Joined: Jul 02, 2008
Posts: 7
I need to change the icon image of shortcut created.

It needs to be implemented in java.

Thanks
Lucky
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Lucky Dhar
Greenhorn

Joined: Jul 02, 2008
Posts: 7
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

Joined: Jan 10, 2002
Posts: 61430
    
  67

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 .


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Lucky, you can continue asking the same question here again and again but that won't change the answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to change the default icon of a shortcut file on Mac using Java