LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to create a launcher for a Java application (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-create-a-launcher-for-a-java-application-816579/)

ratilio 06-27-2010 12:39 AM

How to create a launcher for a Java application
 
Ok I just downloaded this program called Phex, it is a really cool program and i get it to run, but only from command line. I downloaded this program and its already compiled and works fine but i can only launch it from a command line by typing "java -jar phex.jar"
I have created launchers before and they have worked, but this one just doesn't work. I have all permissions on the directory and the files, but how to create a launcher for this file. Can anyone help me?

smoker 06-27-2010 01:52 AM

Give the full path to phex.jar in the command, or create a script containing the command (with full path) and launch that instead.

ratilio 06-27-2010 04:55 PM

Thanks for this, I will give it a try and see if it works

ratilio 06-27-2010 05:30 PM

Quote:

Originally Posted by smoker (Post 4016086)
Give the full path to phex.jar in the command, or create a script containing the command (with full path) and launch that instead.

I was not able to create the script. Can you tell me how would you do it?

ratilio 06-27-2010 06:20 PM

Ok I created a text file with the command "java -jar /usr/local/Phex/phex.jar" and gave it executable permissions and it works now. But the only thing is that when I double click it to start it it asks me "Do you want to run Phex? or display its contents?" "Phex" is an executable text file" and then it gives me the options "run in terminal" "display" "cancel" "run". If I click "run in terminal" the terminal opens, the program is executed and the program runs, but I need to have the terminal open while the program runs. If I click "display" it doesn't run, and if I click run it runs fine, but I want it to start just by double clicking on it without it asking me this question all the time. Do you know how can I do this?

knudfl 06-29-2010 05:55 AM

The usual way to use such a "jar starter script" :

Copy the script to /usr/local/bin/

And create a launcher / "Icon" / "Phex.desktop" file
that has : Exec=script-name.

That works !
..

ratilio 06-30-2010 02:49 AM

Quote:

Originally Posted by knudfl (Post 4018065)
The usual way to use such a "jar starter script" :

Copy the script to /usr/local/bin/

And create a launcher / "Icon" / "Phex.desktop" file
that has : Exec=script-name.

That works !
..


Hey thanks for replying, I thought nobody was going to reply again, I will give it a try and see what happens.

knudfl 06-30-2010 03:46 AM

Quote:

I thought nobody was going to reply again
Well, may be you would have found the solution yourself.
( A command / solution is easier to remember, when you
"invent" it yourself.) .. :)
So that's a good reason to hold back an answer for a day or two.

Also : It has been answered before,
you might eventually have found this :
http://www.linuxquestions.org/questions/search.php
LQ Search → 'Tag Name' = java+jar
..

ratilio 06-30-2010 03:59 PM

Quote:

Originally Posted by knudfl (Post 4019089)
Well, may be you would have found the solution yourself.
( A command / solution is easier to remember, when you
"invent" it yourself.) .. :)
So that's a good reason to hold back an answer for a day or two.

Also : It has been answered before,
you might eventually have found this :
http://www.linuxquestions.org/questions/search.php
LQ Search → 'Tag Name' = java+jar
..

I was not able to do it, so I am going to just keep the current launcher I created even if it always asks me those 3 questions. Thanks for your help though


All times are GMT -5. The time now is 02:43 PM.