mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-27 06:25:23 +00:00
Merge pull request #45271 from flokli/java-docs
docs: properly document what jdk really points to, explain home passthru
This commit is contained in:
commit
c8a8f49dbc
@ -15,13 +15,17 @@ stdenv.mkDerivation {
|
|||||||
buildPhase = "ant";
|
buildPhase = "ant";
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
Note that <varname>jdk</varname> is an alias for the OpenJDK.
|
Note that <varname>jdk</varname> is an alias for the OpenJDK (self-built
|
||||||
</para>
|
where available, or pre-built via Zulu).
|
||||||
|
Platforms with OpenJDK not (yet) in Nixpkgs (<literal>Aarch32</literal>,
|
||||||
|
<literal>Aarch64</literal>) point to the (unfree)
|
||||||
|
<literal>oraclejdk</literal>.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
JAR files that are intended to be used by other packages should be installed
|
JAR files that are intended to be used by other packages should be installed
|
||||||
in <filename>$out/share/java</filename>. The OpenJDK has a stdenv setup hook
|
in <filename>$out/share/java</filename>. JDKs have a stdenv setup hook
|
||||||
that adds any JARs in the <filename>share/java</filename> directories of the
|
that add any JARs in the <filename>share/java</filename> directories of the
|
||||||
build inputs to the <envar>CLASSPATH</envar> environment variable. For
|
build inputs to the <envar>CLASSPATH</envar> environment variable. For
|
||||||
instance, if the package <literal>libfoo</literal> installs a JAR named
|
instance, if the package <literal>libfoo</literal> installs a JAR named
|
||||||
<filename>foo.jar</filename> in its <filename>share/java</filename>
|
<filename>foo.jar</filename> in its <filename>share/java</filename>
|
||||||
@ -57,7 +61,18 @@ installPhase =
|
|||||||
<literal>${jre}/bin/java</literal> instead of
|
<literal>${jre}/bin/java</literal> instead of
|
||||||
<literal>${jdk}/bin/java</literal>, you prevent your package from depending
|
<literal>${jdk}/bin/java</literal>, you prevent your package from depending
|
||||||
on the JDK at runtime.
|
on the JDK at runtime.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Note all JDKs passthru <literal>home</literal>, so if your application
|
||||||
|
requires environment variables like <envar>JAVA_HOME</envar> being set, that
|
||||||
|
can be done in a generic fashion with the <literal>--set</literal> argument
|
||||||
|
of <literal>makeWrapper</literal>:
|
||||||
|
|
||||||
|
<programlisting>
|
||||||
|
--set JAVA_HOME ${jdk.home}
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
It is possible to use a different Java compiler than <command>javac</command>
|
It is possible to use a different Java compiler than <command>javac</command>
|
||||||
|
Loading…
Reference in New Issue
Block a user