Question

I have been looking everywhere, and being a novice at Java and lacking proper terminology it seems impossible to find this. I assume the correct term is "wrapping", but looking at other Java applications, such as: Minecraft, and seeing how pretty the launcher is and custom buttons, it seems impossible to accomplish such a feat with JFrame. Do they code their own sort of frame? I've heard that you can "wrap" Java code in like C++ to make the launcher, and after passing the screen is launches the game (minecraft.jar). Also, how is the exe file created? That once it is run it checks for a patch from the server, that installs the necessary files in a given directory and checks there for save files? Is it another language? if so which? Which do You recommend? A resource for learning all of this? These are the main aspects that I've been struggling to learn as no one seems to ask a similar question as I.

Also, considering Java is cross-platform, my main targets are Windows > Mac, for now I can't be bothered to worry about Linux considering I'm already struggling so much here; so for now, how to create a Exe file, if need be, in C++ or any other language, then perhaps DMG for Mac.

Was it helpful?

Solution

You have a lot of things to consider. I would suggest that for now you use Java WebStart to launch your application. This gives you things like:

  • Easy distribution - put files on a web server somewhere and a JNLP file describing how to glue your files together.
  • No messing with EXE-wrappers and multiple distributions - this is in the standard Java installation.
  • Easy updates - just create a new set of files (don't update jars in place) and a new JNLP and thats it.
  • A sandbox without any effort. Full access to the machine needs code signing which these days is a moving target. Sandbox should be enough for quite a bit though.

Then when you find you have enough users to warrant platform-specific distributions, you can add these as needed instead of getting everything working up front, where you should be concentrating on your application instead.

OTHER TIPS

If you do not want to go the JNLP route, there a number of tools which can do what you ask for.. my favorite is launch4j, which is easy to use via the launch4j-maven-plugin, see e.g. this launch4j-demo illustrating how to use it.

PS: Alternatives include http://sourceforge.net/projects/jsmooth/ or http://www.ej-technologies.com/products/exe4j/overview.html (.com). Note that similar Qs to this with more have been asked on How can I convert my Java program to an .exe file?, How Can I convert Java To Exe, Best free tool to build an exe from Java code?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top