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

**URL:** <https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160>\
**Category:** Factual Questions\
**Created:** [July 26, 2006, 9:40pm UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160 "2006-07-26T21:40:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Captain\_Carrot](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Captain\_Carrot](https://boards.straightdope.com/u/Captain_Carrot)\
**Post date:** [July 26, 2006, 9:40pm UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/1 "2006-07-26T21:40:22Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![ratatoskK](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ratatoskk/32/2987_2.png) [@ratatoskK](https://boards.straightdope.com/u/ratatoskK)\
**Post date:** [July 26, 2006, 10:13pm UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/2 "2006-07-26T22:13:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [July 26, 2006, 10:18pm UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/3 "2006-07-26T22:18:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Captain\_Carrot](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Captain\_Carrot](https://boards.straightdope.com/u/Captain_Carrot)\
**Post date:** [July 27, 2006, 1:14am UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/4 "2006-07-27T01:14:29Z")

</div>

> [@ultrafilter](#):
>
> Seems like the easiest thing to do would be to make a Java applet and embed it in a local HTML document.

Oh, okay. Thanks!

> [@ultrafilter](#):
>
> What on earth do you need a driver for?

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.

---

<div class="post-metadata">

**Author:** ![mrrealtime](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mrrealtime](https://boards.straightdope.com/u/mrrealtime)\
**Post date:** [July 27, 2006, 1:26am UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/5 "2006-07-27T01:26:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Number](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/number/32/242_2.png) [@Number](https://boards.straightdope.com/u/Number)\
**Post date:** [July 27, 2006, 1:30am UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/6 "2006-07-27T01:30:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Captain\_Carrot](https://avatars.discourse-cdn.com/v4/letter/c/f0a364/32.png) [@Captain\_Carrot](https://boards.straightdope.com/u/Captain_Carrot)\
**Post date:** [July 27, 2006, 2:05am UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/7 "2006-07-27T02:05:24Z")

</div>

> [@mrrealtime](#):
>
> you could just write it in actionscript and package it as an .exe file from flash. Thats what I do.

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.

> [@mrrealtime](#):
>
> If you insist on writing in java, you could simply embed it in a webpage and run it that way.

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.

> [@Number](#):
>
> Not to quash your creative instincts, but is there a reason you don’t just install Minesweeper through Add/Remove Programs?

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

---

<div class="post-metadata">

**Author:** ![mrrealtime](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@mrrealtime](https://boards.straightdope.com/u/mrrealtime)\
**Post date:** [July 27, 2006, 8:28am UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/8 "2006-07-27T08:28:41Z")

</div>

Embedding java in a webpage:

> **[JDK 21 Documentation - Home](https://docs.oracle.com/en/java/javase/21/)**
>
> The documentation for JDK 21 includes developer guides, API documentation, and release notes.

---

<div class="post-metadata">

**Author:** ![Crowbar\_of\_Irony\_3](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@Crowbar\_of\_Irony\_3](https://boards.straightdope.com/u/Crowbar_of_Irony_3)\
**Post date:** [July 27, 2006, 11:01am UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/9 "2006-07-27T11:01:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [July 27, 2006, 11:15am UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/10 "2006-07-27T11:15:21Z")

</div>

[gcj](http://gcc.gnu.org/java/) creates standalone Java executables.

---

<div class="post-metadata">

**Author:** ![Dervorin](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@Dervorin](https://boards.straightdope.com/u/Dervorin)\
**Post date:** [July 27, 2006, 4:28pm UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/11 "2006-07-27T16:28:58Z")

</div>

[QUOTE=ExtraKun]  
Or perhaps you might want to package it as ,jar file, and then giving an .bat file to launch it?  
[/QUOTE]

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

---

<div class="post-metadata">

**Author:** ![Crowbar\_of\_Irony\_3](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@Crowbar\_of\_Irony\_3](https://boards.straightdope.com/u/Crowbar_of_Irony_3)\
**Post date:** [July 28, 2006, 3:03am UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/12 "2006-07-28T03:03:58Z")

</div>

[QUOTE=Dervorin]  
Yes, but if you put a bat in a jar you’re cramping its style. :dubious:  
[/QUOTE]

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

(or am I being whooshed?)

---

<div class="post-metadata">

**Author:** ![Dervorin](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@Dervorin](https://boards.straightdope.com/u/Dervorin)\
**Post date:** [July 28, 2006, 8:24am UTC](https://boards.straightdope.com/t/how-can-i-package-my-program-as-a-stand-alone-executable/366160/13 "2006-07-28T08:24:21Z")

</div>

[QUOTE=ExtraKun]  
Er…the .bat shall be outside the .jar, right?

(or am I being whooshed?)  
[/QUOTE]

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

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