Putting an application in a Jar file

Packaging a Java application in a .jar file is the last step that can make the application truly "portable" -- you can send it to someone and they can just run it. Someday, a Java .jar will work like a PDF or GIF. Once they have the file or email attachment, they can just double-click it and the right thing happens.

(Editorial) It would be great if Sun would emphasize the double-click .jar feature more. I suspect Sun's command-line culture has a hard time understanding the importance of seamless double-click for the GUI masses. Also, Sun is pushing Java Web Start (below) as the ultimate solution for this sort or thing.

The Common Use Case

You have a bunch of .class files that you want to package together into an application...

I look forward to the day when people can exchange .jar applications just like they exchange PDF and GIF today. To distribute an application, I'll just put its .jar file on my web page along with a single link to the official current Java Runtime download page for people who don't have Java installed (just like PDF and acrobate today).

Links