Scroll to navigation

JPACKAGE_SCRIPT(7) Miscellaneous Information Manual JPACKAGE_SCRIPT(7)

NAME

jpackage_scriptgenerate a shell launcher script for a Java application in an RPM build

SYNOPSIS

%jpackage_script [-h] [-c config_file] main_class flags options jars script_name

DESCRIPTION

The jpackage_script RPM macro creates a shell launcher script that prepares the runtime environment and then invokes a Java application. It is typically invoked during the %install phase of an RPM build. The script is written to %{buildroot}%{_bindir}/script_name.

The generated script uses helper functions from %{javadir}-utils/java-functions to construct the classpath, process flags and options, and execute the JVM. It also reads optional configuration files to allow system-wide and per-user customization.

If the RPM macro %{java_home} is defined at build time, the generated script hardcodes its value as the default JAVA_HOME. If %{java_home} is not defined, the generated script locates the java executable using the user's PATH. Users can override the selected Java runtime by setting JAVA_HOME in their environment.

When the -h option is specified, the macro does not embed any default JAVA_HOME setting in the generated script, leaving runtime selection entirely to the user environment.

OPTIONS

Do not set a default value for JAVA_HOME in the generated script. The script will rely on the user's environment or lookup via PATH.
config_file
Specify the name of the configuration file sourced by the generated script instead of the default %{_sysconfdir}/java/%{name}.conf.

ARGUMENTS

main_class
Fully qualified name of the Java main class to execute.
flags
Whitespace-separated JVM flags to apply by default.
options
Whitespace-separated application options to apply by default.
jars
A colon-separated list of JAR names. Each element is processed with build-classpath to produce the runtime classpath.
script_name
Name of the launcher script to create in %{_bindir}.

FILES

%{javadir}-utils/java-functions
Helper functions used by the generated launcher script.
%{_sysconfdir}/java/%{name}.conf
Default system-wide configuration sourced by the generated script.
$HOME/.%{name}rc
Optional per-user configuration sourced by the generated script.

EXAMPLES

Generate the msv launcher with the main class “msv.textui.Driver” and a classpath assembled from multiple libraries:

%jpackage_script msv.textui.Driver "" "" msv-msv:msv-xsdlib:relaxngDatatype:isorelax msv

SEE ALSO

build-classpath(1), rpm-macros(7), rpm(8)

AUTHORS

Mikolaj Izdebski <mizdebsk@redhat.com>

February 18, 2026 Linux 6.4.0-150700.53.40-default