File Association for JARS

Derek Broughton news at pointerstop.ca
Sat Jan 26 00:52:12 UTC 2008


Johnny Kewl wrote:

> The problem is that Java JAR files are both Archives and Executables.
> Ubuntu seems to be set up so that a JAR looks like a ZIP file.

That's not a problem, that's a feature:-)
> 
> A java executable runs with the comand line
> java -jar %1
> 
> ie if the %1 is a Java file the application starts....
> 
> One does have to question the wisdom of Sun make file.jar behave as both
> but thats how it is.

Huh?  There are any number of applications that use zip (or similar) formats
for file storage.  Off the top of my head, python eggs, GIS shape files,
Google maps files, ARGO UML models...  There's nothing "unwise" about it,
and for sparse data that is expected to be transmitted across a network, it
makes a lot of sense.
> 
> So... what I'm looking for is the basic instructions to set up ubuntu so
> that if a user clicks on a JAR file the thing runs...

In Kubuntu, go to Konqueror, Settings, File Associations.  Select "*.jar",
add (DON'T replace) a command to execute the jar.  Keep the existing one -
you WILL eventually want to see what's in a jar file - but you might want
the execution mode to be the default.  Gnome has something very similar.
> 
> The area I'm really nor sure about is the relationship between the Desktop
> and the Browser mime type.. If I remember on Debian it was always a
> mission getting Mozilla and Gnome to do the same thing...
> 
> Hopefully Ubuntu is smarter than that....

Not really - Firefox doesn't rely on the system settings.

> So how to make Click on JAR run... on ubuntu in Firefox and default
> Desktop (looks like its KDE from emails)

Don't know what you do in Firefox - nobody in their right mind uses it as a
default (OK, I _know_ I'm one of the few in our right minds...)
-- 
derek





More information about the ubuntu-users mailing list