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
Pauline McNamara
Sheriff
Joined: Jan 19, 2001
Posts: 4009
posted
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.
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11937
posted
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?
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
Sheriff
Joined: Jan 23, 2002
Posts: 11937
posted
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).