IndieRunner::Engine::Java(3p)

NAME
IndieRunner::Engine::Java - Java engine module

DESCRIPTION
Module to set up and launch games made with Java. Currently supports games made with Java versions 1.8.0, 11, 17, and 21.

fix_jvm_args()
    Quirks for certain arguments to the JVM.

get_bundled_java_version()
    Many Java games are distributed with bundled Java files. In order to match the Java version that the game was created with, get the version number from the bundled files to later pick the right native binary.

set_java_home($v)
    Assign the correct JAVA_HOME based on the version $v.

replace_lib($lib)
    Returns a system library to serve as a replacement for bundled library $lib. Returns an empty string if none is found.

bundled_libraries()
    Identify bundled libraries, then find replacements for them. Returns a hash, containing each bundled library and its replacement.

setup()
    Setup for Java games: extract JAR file, identify key data like "main_class", replace bundled libraries, identify the bundled frameworks (LWJGL2, LWJGL3, LibGDX, ...), and invoke each framework's setup method.

has_libgdx()
    Look for libgdx in bundled files. Returns 1 if found, 0 if not.

has_steamworks4j()
    Look for Steamworks4j in bundled files. Returns 1 if found, 0 if not.

has_lwjgl_any()
    Look for LWJGL in bundled files. Returns 1 if found, 0 if not.

lwjgl_2_or_3()
    Return the major version of bundled LWJGL.

detect_java_frameworks()
    Returns an array of the bundled frameworks (LWJGL 2/3, Steamworks4j).

skip_framework_setup()
    Checks if the game is one where framework setup is disabled.

test_exec_jar()
    Check if the game is one where the JAR is executed directly.

jar_no_bundled_config()
    Check if this is a game that has to run without checking for a bundled config file.

new($class, %init)
    Constructor that detects/sets the following:

    •   $Bit_Sufx

    •   $exec_jar or $main_class

    •   $java_v

    •   $java_home

    •   $config_file

    •   $game_jar

    •   @jvm_args

    •   @jvm_classpath

    It proceeds to extract $game_jar, unless $exec_jar is set. The data is collected from various bundled files, including bundled shell scripts.

get_bin()
    Return the Java binary.

get_args_ref()
    Assembles and returns the arguments to the Java binary. This involves setting the classpath based on the frameworks that are used, as well as game-specific quirks to the arguments.

get_env_ref()
    Returns the array ref for the Java environment variables, i.e. JAVA_HOME.

CAVEATS
There are many different ways in which Java-based games are distributed and it is impossible to account for all possible variations. The parsing of files like .config files and especially the shell scripts to obtain the necessary information for execution is a potential source of errors.

AUTHOR
Thomas Frohwein <thfr@cpan.org>.

SEE ALSO
IndieRunner::Engine, IndieRunner::Engine::JavaMod, IndieRunner::Engine::LWJGL2, IndieRunner::Engine::LWJGL3, IndieRunner::Engine::LibGDX, IndieRunner::Engine::Steamworks4j.

COPYRIGHT
Copyright 2022-2025 by Thomas Frohwein <thfr@cpan.org>.

This program is free software; you can redistribute it and/or modify it under the ISC license.