• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Running jar files on linux

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the secret to running an executable jar file on Linux by clicking on the file? I have java 1.5.x that came with the distro, but is from Sun, is there a missing file?

I can run it via command line.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Depends on the Linux desktop you're using. It's just a matter of adding a file association so that ${JAVA_HOME}/bin/java is used to launch jar files with the proper command-line arguments -- but the details of doing so are distro- and/or desktop- specific.
 
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Linux (and any Unix) does not have the concept of "file extension associations" in the way Windows does.

Suggest you write a shell script that executes the correct 'java -jar xxx' command, and click that.

Guy
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With Ubuntu...i double-click and it launch the jar...just like in MacOs or Window$
arno
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Guy Allard:
Linux (and any Unix) does not have the concept of "file extension associations" in the way Windows does.



Ummmmm... Guy, wake up -- it's 2007!

All the popular Linux desktops (KDE, Gnome, etc) offer this feature, and have for some years now. Most distros include a large number of such associations out of the box, including clickable jar files.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<nitpick-mode>
Technically, he's right. Linux doesn't.
</nitpick-mode>

But then again, the desktop GUI shell (a/k/a the "desktop") is neither part of Linux, nor its most popular GUI add-on (X Windows). Gnome, KDE, sawfish, etc. are GUI layers independent of the OS or window managers.

But, as Ernest has pointed out, these days most of them do support some sort of mapping between desktop objects and applications.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tim Holloway:
<nitpick-mode>
Technically, he's right. Linux doesn't.
</nitpick-mode>



<nitpick-mode>
Technically, Windows can only execute .exe, .bat and .com -Files, and uses a similar technique, to associate Files to Programs.
</nitpick-mode>
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tim Holloway:
<nitpick-mode>
Technically, he's right. Linux doesn't.
</nitpick-mode>



Indeed; and to the same extent, it doesn't have the notion of "clicking on files!" To the extent that "clicking on files" has some reality, then file associations do, too
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but the notion of a file being executable is embedded in the OS.

And the various GUI implementations support that. Naturally.

The OS does not support file associations.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic