1

I am rather new to programming and have begun designing a text-adventure game in Java. I am currently having difficulty finding out how to make the text-adventure playable on machines that don't have a JRE such as BlueJ or Eclipse installed. I would like to share my game with friends but don't want to install the JDK and a JRE for them to play it.

Thanks for the help in advance.

  • If they want to run java bytecode they should have a JRE installed or install one, one way or another. There's no escaping. – Federico klez Culloca Mar 20 '18 at 13:41
  • 1
    Possible duplicate of [What's the best way to distribute Java applications?](https://stackoverflow.com/questions/80105/whats-the-best-way-to-distribute-java-applications) – kryger Mar 20 '18 at 13:43
  • If you have a JDK 9, you can create executables from Java using [`jlink`](https://docs.oracle.com/javase/9/tools/jlink.htm). – Olivier Grégoire Mar 20 '18 at 13:43
  • @OlivierGrégoire that would still qualify as installing a JRE (albeit a reduced one), am I right? – Federico klez Culloca Mar 20 '18 at 13:45
  • @FedericoklezCulloca It's not installing the JDK: it's making it available as part of the installation of the game. The JDK will be physically present on the computer but not installed (as in messing with all the Windows installation). – Olivier Grégoire Mar 20 '18 at 13:51
  • 1
    your friends will only need the JRE btw – arxakoulini Mar 20 '18 at 14:14

2 Answers2

1

1) Using Java Web Start

Java Web Start software provides the power to launch full-featured applications with a single click. Users can download and launch applications, such as a complete spreadsheet program or an Internet chat client, without going through lengthy installation procedures.

2) The Java Packager Tool (For Java 9)

The Java Packager tool can be used to compile, package, sign, and deploy Java and JavaFX applications from the command line. It can be used as an alternative to an Ant task or building the applications in an IDE

3) Wrapping Java to EXE

Multi-platform tools can generate native installers for multiple platforms — Windows, OS X, Linux

Akila
  • 1,258
  • 2
  • 16
  • 25
0

Terminology

  • JDK

    This is the Java SE Development Kit, which contains all of the JRE and also tools for building java programs.

  • JRE

    This is the Java Runtime Environment, which only had the bits needed to run java programs

  • IDE

    This is the Integrated Development Environment, which only the developer needs, such as Eclipse, BlueJ or IDEA.

What do users need

To run a JAR or class file the user needs:

  • Any dependencies that the program needs
  • Either a JDK or a JRE

Using JLink

You can use JLink to make a small version of the JRE, with only the packages which your program needs to run, reducing the install size, this can then be packaged with your game.

Advantages

  • Smaller than a full JRE
  • Faster to load

Disadvantages

  • If lots of apps have their own JRE then space may be wasted
  • You will need to update the JREs individually if an update happens
jrtapsell
  • 6,719
  • 1
  • 26
  • 49