Java in Gentoo: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Libraries (JAR) locations ==
= Installing a JDK =
 
* For some applications, you may need the jce USE flag set for the sun-jdk (Java Cryptography Extension). Note that emerging sun-jce-bin is not enough.
 
= Libraries (JAR) locations =


* Java packages are VERY often SLOTed.
* Java packages are VERY often SLOTed.
Line 5: Line 9:
* If a package is SLOTed, the jar go to /usr/share/package-name-SLOT/package-name.jar. Note that in the JAR there should not be any version number. Beware that some old/badly written ebuilds can forget to specify a SLOT, thus, the jar end in /usr/share/package-name/package-name.jar. This can be confusing when using java-config -p which report the location of the JAR (since it may mask the fact that another version of the package exist).
* If a package is SLOTed, the jar go to /usr/share/package-name-SLOT/package-name.jar. Note that in the JAR there should not be any version number. Beware that some old/badly written ebuilds can forget to specify a SLOT, thus, the jar end in /usr/share/package-name/package-name.jar. This can be confusing when using java-config -p which report the location of the JAR (since it may mask the fact that another version of the package exist).


== Classpath ==
= Classpath =


* The java command on Gentoo honors the CLASSPATH variable. So often the best way to specify the classpath is via this variable.
* The java command on Gentoo honors the CLASSPATH variable. So often the best way to specify the classpath is via this variable.
* Always remember than when using the -jar switch, java ignores both the -cp argument and the CLASSPATH. The classpath is built via the instructions on the Manifest file of your jar. The alternative is to not use jar, thus writing something like:
java -cp "/path/my.jar" net.elvanor.main
* Sometimes it can be useful to symlink to existing jars in the place where they are expected by a jar manifest.
= Java Web Start =
* .jnlp files are Java Web Start files.
* JWS works in Gentoo, but there is a bug in the path of the javaws launcher (icedtea-web package), and it must be fixed manually unfortunately. Once this is done, JWS will work.

Latest revision as of 18:17, 17 August 2015

Installing a JDK

  • For some applications, you may need the jce USE flag set for the sun-jdk (Java Cryptography Extension). Note that emerging sun-jce-bin is not enough.

Libraries (JAR) locations

  • Java packages are VERY often SLOTed.
  • If a package is SLOTed, the jar go to /usr/share/package-name-SLOT/package-name.jar. Note that in the JAR there should not be any version number. Beware that some old/badly written ebuilds can forget to specify a SLOT, thus, the jar end in /usr/share/package-name/package-name.jar. This can be confusing when using java-config -p which report the location of the JAR (since it may mask the fact that another version of the package exist).

Classpath

  • The java command on Gentoo honors the CLASSPATH variable. So often the best way to specify the classpath is via this variable.
  • Always remember than when using the -jar switch, java ignores both the -cp argument and the CLASSPATH. The classpath is built via the instructions on the Manifest file of your jar. The alternative is to not use jar, thus writing something like:
java -cp "/path/my.jar" net.elvanor.main
  • Sometimes it can be useful to symlink to existing jars in the place where they are expected by a jar manifest.

Java Web Start

  • .jnlp files are Java Web Start files.
  • JWS works in Gentoo, but there is a bug in the path of the javaws launcher (icedtea-web package), and it must be fixed manually unfortunately. Once this is done, JWS will work.