Page 1 of 2 12 LastLast
Results 1 to 20 of 25
  1. #1
    Join Date
    Aug 2008
    Posts
    26
    Rep Power
    0

    Default Executing a jar double-click style in Linux

    here a way i tried(worked in Fedora 6):

    Step 1 : Right Click the jar file choose Properties->Open with->click
    Add->use a custom command->browse (now searc for the dir
    containing jre(Java Runtime Enviornment) folder ). on my machine
    its in 'usr -> local -> jdk1.6.0_07 -> jre-'(Wherever jre folder is
    located) open the lib folder (in jre only) add choose 'jexec' and
    click open and add it.
    Step 2 : Now it will be seen selected in the Properties window (if not select
    it).

    Step 3: Click the Permission tab in the Properties window and select the
    Check box "Allow Executing this file as Program."

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    And what is your question,please?

  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
    Join Date
    Aug 2008
    Posts
    26
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    Are you saying that by double-click you can't run a jar file in Linux?
    well yes , for me it showed the contents of the jar file(the classes etc).rather than execute it.
    Even in my college lab it did the same.
    So this is for those who encouter this problem and want to execute the jar with a double click.

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

  6. #6
    Join Date
    Aug 2008
    Posts
    26
    Rep Power
    0

    Default

    Quote Originally Posted by Eranga View Post
    What happen when you double click on the jar file? Any logs on the console?
    Well Linux doesn't directly executes jars. it unzips(unjars) it and show you the class files inside.

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

    Default

    Linux doesn't directly executes jars. it unzips(unjars) it and show you the class files inside.
    That may be the default on some versions of Linux. The command to be executed on a double click comes from a control file somewhere and can be set to java -jar <filename> as you showed.
    It probably depends on the version of Linux and on how the JDK was installed.

  8. #8
    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

    Quote Originally Posted by goodwillwins View Post
    Well Linux doesn't directly executes jars. it unzips(unjars) it and show you the class files inside.
    I'm not expert on Linux environment, but I work on Knopix, a Linux version. In that jar files are able to execute on double click.

  9. #9
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    For all guys,Java libraries on Linux machines can be found either in /usr/java folder or in /usr/lib/jvm (on Suse it is in /usr/local,but it is not its destination,because most of the java applications search java in the folders which i pointed here).

    Enter one of these folders and watch what is there,it should be either jdk or jre installed (sometimes java-sun),enter one those folders and you will see some folders and files,and then enter the bin folder and you will find binary file called "java",that is what opens all java files,for JNLP files use javaws.

    If the file doesn't open with the double click on Linux system it means that JAVA_HOME or JRE_HOME is not exported on run.

  10. #10
    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

    Thanks for the information. Actually in my Linux machine I can only found /usr/java folder. Not in lib. :)

  11. #11
    Join Date
    Aug 2008
    Posts
    26
    Rep Power
    0

    Default

    Well I stand corrected.I guess it does execute on double cilck on some versions of Linux. But does anyone use Fedora .

    Because on Fedora 6 I've ecountered this problem.Will try Knoppix sometime and see.

  12. #12
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Man,jar files can be opened in Fedora also by double click,you just need to configure the path to java for opening such files with such extension,and that's all folks.

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

  14. #14
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    First of all try in console if the command
    Java Code:
    java -jar *.jar
    works.

    If it works ,open java file with... and dialog window in use custom command text field put this command:

    Java Code:
    java -jar %f
    or
    Java Code:
    /usr/lib/jvm/jre-1.5.0-sun/bin/java -jar %f
    According where your java is located on the system
    Which Fedora do you use with KDE or GNOME?
    Last edited by serjant; 09-27-2008 at 10:25 AM.

  15. #15
    Join Date
    Aug 2008
    Posts
    26
    Rep Power
    0

    Default

    Aright will try that that.Thanks

  16. #16
    Join Date
    Aug 2008
    Posts
    26
    Rep Power
    0

    Default

    java -jar *.jar------------works

    usr/local/jdk1.6.0_07/jre/bin/java -jar %f-------doesnt work
    (This command executes but doesnt make it executable)

    I'm using Fedora 6.
    Will i have do to this every time i need to open a different file .Or just once and its gets appilied to all jar files.


    The way i've mentioned at the start of this post has to be configured once and thats it.all the jar file become executable(IN FEDORA)

  17. #17
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    It makes once such files executable on your system.Sign the checkbox checked under the command field

  18. #18
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Like on this screenshot,i do that in Gnome Fedora:


  19. #19
    Join Date
    Aug 2008
    Posts
    26
    Rep Power
    0

    Default

    it does work that way. Thanks serjant for the screen shot.

  20. #20
    georgemc is offline Senior Member
    Join Date
    Sep 2008
    Posts
    135
    Rep Power
    0

    Default

    Just write a shell script to launch the jar. Much simpler than mucking about trying to make all sorts of file associations that, at the end of the day, won't be present on another machine

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 6
    Last Post: 04-08-2009, 04:05 AM
  2. Replies: 21
    Last Post: 08-01-2008, 11:13 AM
  3. NetBeans-style Dockable-windows and toolbar?
    By jimm1 in forum Advanced Java
    Replies: 0
    Last Post: 01-31-2008, 08:41 PM
  4. Mouse Right click option not working in solaris and linux OS
    By dinesh kaushik in forum AWT / Swing
    Replies: 2
    Last Post: 11-21-2007, 04:02 PM
  5. Replies: 2
    Last Post: 08-10-2007, 12:36 AM

Posting Permissions

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