English
Java Packaging Guidelines
This page represents Fedora guidelines for packaging libraries and applications written in Java and related languages using Java Virtual Machine as bytecode interpreter. It does not aim to extensively describe packaging techniques and tips. RPM macros and commands used here are documented in man pages. Furthermore a separate https://fedora-java.github.io/howto/latest/[Java Packaging HOWTO] describes Java packaging techniques in detail and includes examples, templates and documentation aimed at packagers and Java developers who are taking their first steps in Java RPM packaging.
Fedora Java packaging is originally based on https://web.archive.org/web/20191223234327/http://www.jpackage.org/[JPackage Project] standards. Over time we have diverged in packaging tools in most areas but we mostly keep backward compatibility with older packages that make use of JPackage standards.
Package naming
Packages MUST follow the standard Fedora xref:Naming.adoc[package naming guidelines].
Java API documentation MUST be placed into a sub-package called `+%{name}-javadoc+`.
Release tags
Packages MUST follow the standard Fedora xref:Versioning.adoc[package versioning guidelines].
Pre-built dependencies
Packages MUST follow the standard Fedora xref:what-can-be-packaged.adoc#prebuilt-binaries-or-libraries[dependency bundling guidelines].
In particular `+*.class+` and `+*.jar+` files from upstream releases MUST NOT be used during build of Fedora packages and they MUST NOT be included in binary RPM.
JAR file installation
The following applies to all JAR files except <<JNI,JNI-using JAR files>> and application-specific JAR files (i.e., JAR files that can only reasonably be used as part of an application and therefore constitute application-private data).
Split JAR files
If a project offers the choice of packaging it as a single monolithic JAR or several ones, the split packaging SHOULD be preferred.
Installation directory
All architecture-independent JAR files MUST go into `+%{_javadir}+` or its subdirectory.
For installation of architecture dependent JAR files, see <<JNI>>.
Filenames
If the package provides a *single* JAR file installed filename SHOULD be `+%{name}.jar+`.