• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

How to create alias in Mac using java

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

I am working on a project in Mac OS.And the requirement is that after clicking a button ,a shortcut should be made on the desktop and a pdf file should open.
I need to implement this using java.
I have made the whole Gui in Swings.
Even if we click the shortcut which is made on desktop, the same pdf needs to be launched.

Thanks
 
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Lucky, welcome to Javaranch.

I cannot help you with your problem, but other folks might be able to. You can help them help you if you post what you have done or tried so far. Don't be shy, show us your code.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lucky, do you know you'll be running on a *NIX machine rather than Windows?
If you do, then perhaps you could use the ln UNIX command line tool to create a symbolic link, running the command through java.lang.Runtime?
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well according to your subject this is on a Mac... So I am assuming its Mac OSX rather than windows running on your mac?

I think Lasse Koskela is right on the mark to use the ln command.



For information about how to execute this command from within java take a look at this article:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
 
Lucky Dhar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone.

I tried to implement your suggestions by using
Runtime.getRuntime().exec("ln -s /Users/abc/desktop/text1.pdf /volumes/newcd/mac.pdf");

It is not giving any error while executing.
But a link file is not created on the Desktop.

Please advise.

Thanks,
Lucky
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you check the Process object's return code with Process#waitFor()? You see, the process can fail without any exceptions being thrown (usually exiting a non-zero return code).

The following works on my machine (OSX 10.5):
 
Lucky Dhar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
U GUYS ARE INCREDIBLE!!!

Thanks a lot for helping me out.

Thanks
Lucky
 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic