[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

create a desktop shortcut on linux

Posted on 2004-11-01
8
Medium Priority
?
352 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:spunog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 13

Expert Comment

by:petmagdy
ID: 12461939
Better trick:

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
0
 

Author Comment

by:spunog
ID: 12461955
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.....
0
 
LVL 13

Accepted Solution

by:
petmagdy earned 500 total points
ID: 12462344
no I mean the shortcut is a file that can be programatically generated if it has known format, so thats why I asked u to do it manually first to know how it look like
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:spunog
ID: 12462401
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. ???
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12462435
For KDE look at $HOME/Desktop/*.desktop
The file has the basename of the shortcut.
;JOOP!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12462485
I hate slow lines ..................
0
 

Author Comment

by:spunog
ID: 12462505
Thanks a lot,

Spunog
0
 

Author Comment

by:spunog
ID: 12471483
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 ?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question