How can I package my program as a stand-alone executable?

Today my mom was annoyed because my Windows XP computer didn’t have Minsweeper on it. Now, I can write one for her, but she won’t be able to play it without going into j/pcGRASP, finding the driver, and running it. This is not really something that I want her to have to do; also, isolating the program offers fewer chances for the computer to crash.

I’m planning to have three different files: the driver, the GUI, and the game engine itself. Once I’ve finished writing the code, how do I package it so as to remove it from the context of programming and make it a simple game runnable from an icon (for example) on the desktop?

(This is in Java, by the way.)

Unless this is something you really prefer coding yourself, why don’t you just download some shareware for her?

Seems like the easiest thing to do would be to make a Java applet and embed it in a local HTML document. What on earth do you need a driver for?

Oh, okay. Thanks!

Not a driver in the traditional sense, just a master program that instantiates the various components of the rest of the project.

Well, that’s the thing, ratatoskK: this is the sort of thing I want to code for myself. It’ll give me some summer practice so I won’t be rusty when I go back to school in about six weeks, and it’s a game I’ve written before, so it won’t be too hard to implement except for the applet part.

you could just write it in actionscript and package it as an .exe file from flash. Thats what I do.

If you insist on writing in java, you could simply embed it in a webpage and run it that way.

Not to quash your creative instincts, but is there a reason you don’t just install Minesweeper through Add/Remove Programs?

You assume that I know ActionScript, and that I know how to package something written in it as a .exe. I don’t; that’s the entire point of this thread.

It’s not so much that I insist on writing it in Java as that Java is the only language I know. Also, I do not know how to embed anything on a webpage; I need more detailed instructions than that.

For one thing, that never occurred to me, although I have now done it; I still just plain want to write it myself.

Embedding java in a webpage:

http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html

Or perhaps you might want to package it as ,jar file, and then giving an .bat file to launch it?

gcj creates standalone Java executables.

Yes, but if you put a bat in a jar you’re cramping its style. :dubious:

Er…the .bat shall be outside the .jar, right?

(or am I being whooshed?)

Note to self: do not attempt humour when very sleepy, it will backfire.

I mean put a jar in a bat, of course. :smack: