spunog
asked on
create a desktop shortcut on linux
Hi,
How can I create a desktop shortcut to a script in the users dir from java?
would the easiest way be from using a runtime.exec("ln -s /home/user/script.sh");
If I have an .ico file that I want to use for the shortcut how can I set the shortcut to use it?
Thanks in advance,
Spunog
How can I create a desktop shortcut to a script in the users dir from java?
would the easiest way be from using a runtime.exec("ln -s /home/user/script.sh");
If I have an .ico file that I want to use for the shortcut how can I set the shortcut to use it?
Thanks in advance,
Spunog
ASKER
Thing is I'm doing this as part of an install. FRom java, copy all the apps files to the user directrory and then create a shortcut in /home/user/Desktop. User shouldn't have to do anything.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok I get you now.
Files called : The Link.desktop
If I edit the file it looks like this:
[Desktop Entry]
Exec='/home/user/blah.sh'
Icon=exec
..
..
So If I create this file from java and write it to the users desktop , then hey presto. ???
Files called : The Link.desktop
If I edit the file it looks like this:
[Desktop Entry]
Exec='/home/user/blah.sh'
Icon=exec
..
..
So If I create this file from java and write it to the users desktop , then hey presto. ???
For KDE look at $HOME/Desktop/*.desktop
The file has the basename of the shortcut.
;JOOP!
The file has the basename of the shortcut.
;JOOP!
I hate slow lines ..................
ASKER
Thanks a lot,
Spunog
Spunog
ASKER
I have a small problem with this.
when the file is written to /home/user/Desktop it contains the same text as the manualy created link. However it does not work and when I look at the properties the os doesn't know its a .desktop file...... any ideas ?
when the file is written to /home/user/Desktop it contains the same text as the manualy created link. However it does not work and when I look at the properties the os doesn't know its a .desktop file...... any ideas ?
Create the required Short cut with ur hand first and open the short cut file with VI and see if it the file can be created programatically, if it has a clear format