Forums Register Login

Running jar files on linux

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
With Ubuntu...i double-click and it launch the jar...just like in MacOs or Window$
arno
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
<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.
+Pie Number of slices to send: Send
 

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>
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
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.
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1992 times.
Similar Threads
Unable to load mysql-jdbc driver
different behavior with regex on linux vs windows
EJB Deployment with JARS
Linux vs. Windows jar file - cannot find main class
Jar file accessing folder
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:16:31.