Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / December 2006

Tip: Looking for answers? Try searching our database.

How to run Java program outside of terminal?

Thread view: 
Lawrence - 23 Dec 2006 20:28 GMT
Hi

I have a java program that has compiled and I have a game.java file.
This runs fine by entering manually into the terminal and running it
that way. However is there a way to execute it by just double clicking
it to open the java program?

Any help will be appreciated.

Thanks

Lawrence
Daniel Dyer - 23 Dec 2006 20:52 GMT
> Hi
>
> I have a java program that has compiled and I have a game.java file.
> This runs fine by entering manually into the terminal and running it
> that way. However is there a way to execute it by just double clicking
> it to open the java program?

You need to create an executable JAR file.

A JAR file is a Java ARchive, much like a zip file, that bundles all of  
the files that make up your program.  JAR files are created with the "jar"  
command line tool.

An executable JAR file is one that has a file called MANIFEST.MF in a  
directory called META-INF.  The manifest must include a property called  
"Main-Class" that gives the fully qualified name of the class with the  
main method.

Google should be able to provide plenty of examples.

Once you have created an executable JAR file, your program should run by  
double-clicking on it.

Dan.

Signature

Daniel Dyer
https://watchmaker.dev.java.net - Evolutionary Algorithm Framework for Java

Andrew Thompson - 27 Dec 2006 01:22 GMT
...
> > I have a java program that has compiled and I have a game.java file.
> > This runs fine by entering manually into the terminal and running it
> > that way. However is there a way to execute it by just double clicking
> > it to open the java program?
...
> Once you have created an executable JAR file, your program should run by
> double-clicking on it.

But in addition to that, I would recommend taking it
one step further and launch the Jar using web-start.
Using web-start launch, you can suggest* to the
user that a desktop icon and menu item be created
as well.  (* the user can refuse it, as they wish, and/or
change their minds later and establish an icon for it).

For web-start launch the code would need to be signed,
if it requires extended privileges.  But even that is not
necessary, if it can run in a sandbox.

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.