Announcement

Collapse
No announcement yet.

<SOLVED>A simple question about scripting...<SOLVED>

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    <SOLVED>A simple question about scripting...<SOLVED>

    OK, i have an executable java jar...Now i wanna make it start with a double click...
    To start a java jar u have to type

    java -jar myJar.jar

    and myJar application starts....but i don't want to type "java -jar myJar.jar" everytime i want to execute it..i want to start it by double click, or something similar..how do i do that

    I tried with my run.sh script...in which i put

    "java -jar myJar.jar" after the #!bash thingy...

    And it works allright, but still i have to invoke that run.sh trhough teminal...and i don't like having to to that every time...
    So what is the solution? How do i make a shortcut with parameters?

    Thanks in advance!

    #2
    Re: A simple question about scripting...

    Or the simpler version of a question, how do i make my scripts run at double click is that even possible!

    Comment


      #3
      Re: A simple question about scripting...

      If you want to simply double click on a jar file to "run" it then try this

      K -> System Settings -> Advanced tab -> File Associations
      type "jar" into the search field
      select "x-java-archive"
      Move Sun Java 6 Runtime to the top of the list

      After this change, double clicking on the jar file should start it with "java -jar ..."

      If you would rather create a dedicated shortcut then try this
      rt click K
      Select Menu editor
      Click new item
      add the fully qualified path to your script in the command field
      Click Save

      Make certain the script is executable
      Code:
      chmod +x scriptname

      Comment


        #4
        Re: A simple question about scripting...

        "rt click K" means "right click K", right?

        Comment


          #5
          Re: A simple question about scripting...

          right

          Comment


            #6
            Re: A simple question about scripting...

            Ok, I did it..thanks guy, the second option worked for me, after a little bit of time..thanks again!

            Comment


              #7
              Re: &lt;SOLVED&gt;A simple question about scripting...&lt;SOLVED&gt;

              The script "in between" is sort of unnecessary. Instead of making a menu item to run the script to run the "java -jar myJar.jar2" command, you can simply make a menu item to run the "java -jar myJar.jar" command directly.

              Although a script can be handy to be able to run the command from CLI (with easy to remember script name, and less typing), you could easily create a bash alias for that (instead of a script).

              Of course there is nothing wrong in the script approach, as there usually are more ways than one to accomplish things in linux.

              Comment

              Working...
              X