GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Publishing a java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Publishing a java "executable"" Watch "Publishing a java "executable"" New topic
Author

Publishing a java "executable"

Castor Tack
Ranch Hand

Joined: Dec 06, 2010
Posts: 31
Hi all:

I know that it's technically wrong to say "executable" for a java application. But, how can I publish an application?

Say, I've written a project in java, and it has multiple files. I compile it, and have .class files. I then run the .class files, I see the application launched. But is there any way to convert (or whatever) all the .class files into one file(for instance, a .jnlp file) so that people can run it directly using jvm?

An example would be this:
http://download.oracle.com/javase/tutorial/uiswing/examples/components/index.html#Converter


When you click "launch", a jnlp file is actually downloaded or run, depending on user's choice. How can I make my project into a similar form so that people can directly run it from my site?

Thanks for any inputs.


The BEST user interface design I've ever seen? --- A flush toilet.
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3112
    
  42

Castor Tack wrote:...is there any way to convert (or whatever) all the .class files into one file(for instance, a .jnlp file) so that people can run it directly using jvm?


A JAR file can do that. Particularly, if Main-Class attribute is specified in MANIFEST.MF file of the JAR, you can specify which class to be executed at the first place.

JNLP is a protocol used for distributing Java Web Start applications. That is useful especially when you distribute your application over the web. Have a look at this tutorial for more details of creating Java Web Start applications


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Castor Tack
Ranch Hand

Joined: Dec 06, 2010
Posts: 31
Thanks, man!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14193
    
  20

This explains how to make an executable JAR: Packaging Programs in JAR Files


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
GeeCON Prague 2014
 
subject: Publishing a java "executable"