Results 1 to 14 of 14
  1. #1
    jacatone is offline Member
    Join Date
    Jan 2009
    Posts
    6
    Rep Power
    0

    Default How do I make a Java file executable

    I'm using a file hosting downloader in Ubuntu Linux and I need to know how to make the ".jar" file executable. Anyone know how? Thanks.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Did you read that how to execute jar files in the Sun java tutorial? Or else did you search the forum?

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  4. #4
    jacatone is offline Member
    Join Date
    Jan 2009
    Posts
    6
    Rep Power
    0

    Default

    I guess I didn't make my problem clear. I'm using a Java app in Ubuntu Linux. In previous version I just right clicked on a .jar file and selected "Run with Java 6 Runtime" and it launched. Now I get the following error:

    "The file '/home/jacatone/Desktop/Save/FreeRapid-083u1/frd.jar' is not marked as executable. If this was downloaded or copied from an untrusted source,it may be dangerous to run."

    I already know how to execute this file in a terminal with $ java -jar "file.jar". Just want to be able to launch it the previous way.
    Last edited by jacatone; 07-24-2010 at 07:37 AM.

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,307
    Rep Power
    25

    Default

    Have you tried asking on the Ubuntu forum?

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    What that jar file suppose to do, I mean the file that couldn't execute on the desktop? Because I don't know that it's either custom file you found or a system related.

    As Norm says, did you try this on a Linux forum?

  7. #7
    zartick is offline Member
    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Default

    Its kinda easy actually. Right-click on the jar -> properties -> Permissions tab -> tick "allow executing file as program"
    The only problem is how to make all jar file in ubuntu by default executable.idk for that.

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,307
    Rep Power
    25

    Default

    The trick is setting up the command line. It needs the -jar option between the command and the jar filename.

  9. #9
    zartick is offline Member
    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Default

    owh ya. if that is the case, i guess for future easier desktop click without command line.
    1. right click a jar file.
    2. properties -> open with tab
    3. click Add
    4. click use a custom command
    5. type java -jar and click Add
    6. and make sure the new created is selected and close.

    thanx norm for reminding.

  10. #10
    Tdubz is offline Member
    Join Date
    Nov 2010
    Posts
    1
    Rep Power
    0

    Default

    I've had the same problem for weeks. Just search for "xubuntu restricted extras" in the ubuntu software center. After that, you can go back to your java file, right click go to properties, click the permissions tab, and then click "allow executing file as program". Finally, run the program in java runtime like you normally would. It worked for me and I hope this helps.

  11. #11
    swalker326's Avatar
    swalker326 is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default

    There is a small issue with this, if you need the program to read files from its home directoy you will have to spell out the entire path to the file.

    ex: LOADFILE /home/user/java_app/file_to_load.ext
    INSTEAD OF
    LOADFILE file_to_load.ext

    if you run the program from the terminal it will always try to load the files from the home directory of your java app, I'm not sure what your app is doing but you can use the terminal to make the file executable with the "chmod" command, then you would in a terminal window enter:

    cd /ext/to/app
    THEN
    java -jar name_of_app.jar

    OR

    java -jar /ext/to/app/name_of_app.jar

    also note that you will need to keep that terminal open in order for the java app to run.

  12. #12
    pr3diker is offline Member
    Join Date
    Dec 2010
    Location
    Netherlands
    Posts
    6
    Rep Power
    0

    Default

    can't you just right-click on te .JAR file, -->properties --> permissions --> make executable?

  13. #13
    swalker326's Avatar
    swalker326 is offline Member
    Join Date
    Dec 2010
    Posts
    7
    Rep Power
    0

    Default Linux Greatness

    The best thing about ubuntu and most other graphical linux builds is the fact that there is alot more then one way to do something. In this case there are close to 15 ways that I can think of to change the permission of a file and how the file is dealt with when it is clicked. All the methods have different results or atleast for the most part.

    Being pretty good with linux based OS I always try to give people the command line option to do things seeing as how untill ubuntu or maybe redhat there was no other way of doing these things and the power behind any linux based OS is the fact that this is still a huge part of the OS.

    I'm not great at explaning it, but once you see the true power of using the terminal in any linux/unix based OS you will see what I mean. No more clicking your way to a file, just 1 simple command and you're there and can do anything you want to with the file, rename, edit, move, copy the choices are endless.

    You can for sure just use pr3diker's method, but ubuntu for a reason is NOT like windows, and you should know what makes ubuntu more powerful then windows and mac.

    -Shane-

  14. #14
    nettea1229 is offline Member
    Join Date
    Jan 2014
    Posts
    1
    Rep Power
    0

    Default Re: How do I make a Java file executable

    Quote Originally Posted by zartick View Post
    Its kinda easy actually. Right-click on the jar -> properties -> Permissions tab -> tick "allow executing file as program"
    The only problem is how to make all jar file in ubuntu by default executable.idk for that.

    Thank you this worked for me, after trying scripts in terminal did not.

Similar Threads

  1. Executable File.
    By BeeGee in forum Advanced Java
    Replies: 13
    Last Post: 05-25-2010, 12:35 PM
  2. Replies: 0
    Last Post: 04-28-2010, 03:33 PM
  3. Executable java to read and write to a txt file
    By njoymirror in forum New To Java
    Replies: 2
    Last Post: 03-21-2009, 01:19 AM
  4. Executable Jar File Creation
    By Doctor Cactus in forum New To Java
    Replies: 7
    Last Post: 11-13-2008, 03:31 AM
  5. How , Can I make a executable for distrubution.
    By arpitvavadia in forum AWT / Swing
    Replies: 2
    Last Post: 09-08-2008, 06:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •