Virtual packages are created: java-compiler, java2-compiler, java-virtual-machine, java1-runtime and java2-runtime.
All Java code must be shipped as Java bytecode (*.class files, packaged in a *.jar archive) and with "Architecture: all".
Packages written in Java are separated in two categories: programs and libraries. Programs are intended to be run by end-users. Libraries are intended to help programs to run and to be used by developers.
Both are shipped as Java bytecode (*.class files, packaged in a *.jar archive) and with an "Architecture: all" since Java bytecode is supposed to be portable. It may additionally be shipped as machine code, as produced for example by the GNU Compiler for Java, in a separate architecture-specific package.
This policy does not yet address the issue of documentation (for instance HTML pages made with javadoc).
Java virtual machines must provide java-virtual-machine and depend on java-common. They can also provide the runtime environment that the package contains (java1-runtime and/or java2-runtime). If it does not provide the files itself it must depend on the needed runtime environment.
Packages that contain a runtime conforming to the Java 1.1 specification should provide java1-runtime. Packages that contain a runtime conforming to the Java 2 specification should provide java2-runtime. If a package conforms to both, then it should provide both; however, packages that do not implement the methods from Java 1.1 that have been deprecated in Java 2 must not provide java1-runtime.
They should use /etc/alternatives for the name 'java' if they are command-line compatible with the Sun's java program.
They should have a CLASSPATH predefined which include the needed runtime environment.
If a given source (like the JDK does) brings both a compiler and a virtual machine, you may name the compiler package xxxx-dev.
Some Java classes implement their routines using a "native" language (such as C). This native code is compiled and stored in dynamic libraries (such as JNI modules) that are loaded at runtime. If a virtual machine supports native code, it must include the directory /usr/lib/jni in its search path for these dynamic libraries.