While trying to compile the experimental openjdk-8 package from
source, the jtreg test suite completely failed to run with the error
message "Cannot determine version of java to run jtreg".
I found that the reason was that jtreg expects to find a usable JVM in
/usr/lib/jvm/default-java/, unless $JAVA_HOME provides a different
path. However, this default value will fail if default-jre-headless is
not installed, as may well be the case (e.g., I had manually installed
openjdk-7-jdk without any of the default-(jre|jdk)* packages).
Without default-jre-headless:
$ jtreg -version
Cannot determine version of java to run jtreg
With default-jre-headless:
$ jtreg -version
jtreg, version 4.1 src b02
Installed in /usr/share/java/jtreg.jar
Running on platform version 1.6.0_31 from
/usr/lib/jvm/java-6-openjdk-amd64/jre.
Built with 1.6.0_18 on 07/07/2011 03:57 AM.
Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Since jtreg can still be used without default-jre-headless by setting
JAVA_HOME as appropriate, a "Depends" relationship is not warranted,
but "Recommends" or "Suggests" seems reasonable. An alternative
approach would be to simply use the first java binary found in $PATH
by default, which will usually be whatever the administrator has
selected using update-java-alternatives, which also seems reasonable.
The problem also exists in sid (jtreg_4.1-b09-1), although the error
message is more useful because it directly points at the missing
java binary:
$ jtreg -version
/usr/bin/jtreg: 86: /usr/bin/jtreg: /usr/lib/jvm/default-java/bin/java:
not found