LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-04-2009, 10:31 AM   #1
jdruin
Member
 
Registered: Jul 2003
Location: Louisville aka Derby City
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313

Rep: Reputation: 30
How to create a desktop shortcut to a JAR file?


Hello.

I have installed Paros Web Proxy successfully. I can run the program by going to the command line and entering:

Code:
java -jar paros.jar
I though to create a shortcut I could right click the desktop and create a launcher. The launcher asked for a command in which I put:

Code:
java -jar /full_path/paros.jar
The launcher does not work. I then tried to right click the paros.jar file and create a link. I dragged the link to the desktop. This did not work either.

I see the similarities to Vista, but since no version of Windows really tells you exactly what is happening when you create a shortcut, I have never thought much about them.

What is it I am missing?
 
Old 01-04-2009, 11:00 AM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,294

Rep: Reputation: 138Reputation: 138
Try creating a bash script to run the commands that launch your application and link to the script for your shortcut. By way of illustration, create a text file in your home directory called do_paros and put this text in it:

Code:
#!/bin/bash
java -jar /full_path/paros.jar
This will be your bash script. Make sure that the you start on the first line, first space with "#!/bin/bash". Now open a console and make do_paros executable by running:

$ chmod a+x do_paros

And test the script from the command line to make sure it opens your application by running:

$ ./do_paros

If that works OK, then close the console and try running the script by double clicking on the do_paros file and see if it launches the application. If that works, create a shorcut to do_paros on your desktop and it should work fine.
 
Old 01-04-2009, 02:00 PM   #3
jdruin
Member
 
Registered: Jul 2003
Location: Louisville aka Derby City
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313

Original Poster
Rep: Reputation: 30
This did not work either, but the good news is that the error produced by this method is the same as the errors from the methods I tried earlier. Here is the error:

Exception in thread "main" java.io.FileNotFoundException: db/parosdb.data (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:137)
at org.parosproxy.paros.model.FileCopier.copyLegacy(Unknown Source)
at org.parosproxy.paros.model.FileCopier.copy(Unknown Source)
at org.parosproxy.paros.model.Model.createAndOpenUntitledDb(Unknown Source)
at org.parosproxy.paros.model.Model.init(Unknown Source)
at org.parosproxy.paros.Paros.run(Unknown Source)
at org.parosproxy.paros.Paros.main(Unknown Source)

I think that because the shortcuts are not running in the paros folder, the paros program is looking for the file db/parosdb.data in the shortcuts directory rather than the paros directory.

I am not sure how to work around this though.
 
Old 01-04-2009, 02:04 PM   #4
jdruin
Member
 
Registered: Jul 2003
Location: Louisville aka Derby City
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313

Original Poster
Rep: Reputation: 30
OK. I edited the shortcut file to read:

#!/bin/bash
cd /home/ubuntu/programs/paros
java -jar paros.jar

This worked. I have been using windows for a decade so Linux is taking some getting used to. Thanks for the help.
 
Old 01-04-2009, 03:55 PM   #5
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Quote:
cd /home/ubuntu/programs/paros
This is what made it work, because the "simple" shortcut you first created didn't specify the "working directory".
There might / should have been an option for you to do this ( there is in KDE ).
Now it's working, be happy.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create a desktop url shortcut craftereric Linux - Newbie 5 11-16-2010 05:08 PM
create a shortcut in /home/username/Desktop but not still not appear on desktop! swgiant Linux - Newbie 1 09-27-2008 11:51 AM
desktop shortcut for File System 5muggl3r Linux - Laptop and Netbook 8 12-26-2007 10:01 AM
how create a shortcut on the linux desktop for a executive program cy163 Linux - Newbie 2 12-10-2007 11:41 PM
How to create a desktop shortcut ? juanb Linux - General 1 07-01-2004 03:27 AM


All times are GMT -5. The time now is 01:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration