File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Running an application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Running an application" Watch "Running an application" New topic

Running an application

Ajay Joseph

Joined: Nov 04, 2004
Posts: 21
how we run a java application by double clicking an icon or file. i ask this to run a project with first section as login name and password. i want to create this page as frame or application .

awaiting Reply

Ajay Joseph
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

You have a number of options. You can write batch file which incudes the "java -jar jarFile.jar" command. You could write a piece of naive code to do the same and create a .exe. Or you can tweak the OS to do something simmilar (associate .jar files wit ha more general batch file).

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
If you are putting the application inside a jar file you can make the jar file double clickable to run the application

Creating an executable JAR file

Create a text file to add to the manifest which declares the Main-Class attribute for the application, making sure to add a carriage-return at the end of the line. Adding this will cause the application to look for a main() in Foo.class:

Create the archive and include the manifest addition with a command like this which archives two class files into an executable Foo.jar:

SCJP 1.4,
I agree. Here's the link:
subject: Running an application
It's not a secret anymore!