5
\$\begingroup\$

Heyo!

I have looked for a step by step tutorial everywhere and haven't been able to find anything so please try to be helpful and fairly slow.

I am creating a game for Steam and I am using Java to write it. I chose Java as it can be run cross-platform and is the one in which I am the most familiar. On this recent question I asked I was told I could bundle the JRE I needed with the game using a program like Launch4J. But I can't find anything about converting the bundle into an executable that Mac users can run.

So my questions are thus:

1) Are there any step by step tutorials for bundling a completed Java program with the needed JRE into an executable for not only Windows but Mac users as well?

2) And if not, would someone be kind enough to create a quick step by step list of everything I need to do?

\$\endgroup\$
6
  • 1
    \$\begingroup\$ there was some developer writing about this in his blog. You have to use OpenJDK if you want to accepted as "SteamPlay" title because you must ship the runtime with it. You can not ship the Oracle JRE. \$\endgroup\$ Feb 3 '16 at 16:24
  • \$\begingroup\$ @BenediktS.Vogler thank you for your reply, would you be able to point me in the direction of this developer's blog? \$\endgroup\$ Feb 4 '16 at 13:37
  • \$\begingroup\$ Sadly no, but here on gd stack exchange are some related helpful questions. \$\endgroup\$ Feb 5 '16 at 17:59
  • \$\begingroup\$ @BenediktS.Vogler According to this FAQ, you may distribute Java with your software provided you abide by the terms and conditions for Java binary code licence. oracle.com/us/technologies/java/java-licensing-faqs-365297.pdf \$\endgroup\$ Feb 25 '16 at 19:03
  • 1
    \$\begingroup\$ When you want to bundle the JRE with your game, you won't get around creating separate packages for separate operating systems, because every operating system requires a different JRE build. \$\endgroup\$
    – Philipp
    Jun 14 '16 at 14:38
1
\$\begingroup\$

You might consider packr, one of the libgdx tools.

From the project's read.me description, it

Packages your JAR, assets and a JVM for distribution on Windows, Linux and Mac OS X, adding a native executable file to make it appear like a native app. Packr is most suitable for GUI applications, such as games made with libGDX.

You can specify the JRE you wish to bundle. A good source of pre-built OpenJDK packages is Azul's Zulu OpenJDK distribution.

Another option might be to use Oracle's javapackager, which comes with the Oracle JDK. It's use is described in the Java deployment guide.

One advantage of packr over javapackager is that it supports minimization of the size that the JRE adds to your installation, mainly by removing unneeded classes from rt.jar.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.