jpackage_script - Man Page
generate a shell launcher script for a Java application in an RPM build
Synopsis
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
- -h
Do not set a default value for
JAVA_HOMEin the generated script. The script will rely on the user's environment or lookup viaPATH.- -c 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-classpathto 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
Authors
Mikolaj Izdebski <mizdebsk@redhat.com>