Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have programed a java program. To run it I write java -jar /path/name.jar in the Terminal. I have made a script (.sh) which installs the program on the system. I want the script to create a shortcut to the Java program in both the desktop and the Launcher.

Anyone who know how to do it?

share|improve this question
1  
I believe you should properly package (.deb) your application. Is that what you're looking for? It will be a lot easier to accomplish what you want using a package. –  gertvdijk Jan 28 '13 at 15:14
    
It wasn't what I'm looking for, that's solved, but now I became interested. How can I package my application into a .deb-file? –  Kranis Jan 28 '13 at 18:58
    
I think this is worth a new question, now that you got some answers. Example: "How do I properly package my Java desktop application?" :) –  gertvdijk Jan 28 '13 at 19:20
add comment

2 Answers 2

up vote 4 down vote accepted

Launcher apps are in /usr/share/applications. I would create a .desktop file in that folder.

[Desktop Entry]
Name=My App Name
Exec=/path/to/java -jar /path/name.jar
Terminal=false
Type=Application
Icon=/path/to/my/icon.png
Categories=
share|improve this answer
    
It works fine. Thank you for your help! :D –  Kranis Jan 28 '13 at 17:10
    
I have another question: Does this work with Linux Mint or Fedora? –  Kranis Jan 28 '13 at 19:00
    
The format of the .desktop file should be the same, but the location is probably different. –  Ed Manet Jan 28 '13 at 19:36
add comment

Don't know about Launcher, but for shortcut to Desktop you can use symbolic link:

ln -s /path_to_shell_script $HOME/Desktop

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.