Issue
I need to cross-compile from sources this OpenJava fork https://gitlab.com/gosjava/11/openjdk/-/tree/master/ - for aarch64-linux-gnu devkit target: For that I installed java 10.0.2 as host JDK then ran "./configure"
└─$ ./configure
...
configure: Potential Boot JDK found at /home/katya/java is incorrect JDK version (Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true); ignoring
configure: (Your Boot JDK version must be one of: 10 11)
checking for javac... /home/katya/java/bin/javac
checking for java... /home/katya/java/bin/java
configure: Found potential Boot JDK using java(c) in PATH
configure: Potential Boot JDK found at /home/katya/java is incorrect JDK version (Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true); ignoring
configure: (Your Boot JDK version must be one of: 10 11)
configure: Could not find a valid Boot JDK. You might be able to fix this by running 'sudo apt-get install openjdk-8-jdk'.
configure: This might be fixed by explicitly setting --with-boot-jdk
configure: error: Cannot continue
configure exiting with result code 1
Full log here https://gist.github.com/iva-nova-e-katerina/3061b865beb48dc25594bc360508d6a3 Could you tell me why the configure said that I use wrong JDK?
Solution
That message is being generated by the BOOTJDK_DO_CHECK
autoconf macro whose definition is in "jdk11u/make/autoconf/boot-jdk.m4". If you look at the file you will see the following:
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
[FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION \
| $EGREP "\"(${DEFAULT_ACCEPTABLE_BOOT_VERSIONS// /|})([\.+-].*)?\""`]
if test "x$FOUND_CORRECT_VERSION" = x; then
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect
JDK version ($BOOT_JDK_VERSION); ignoring])
AC_MSG_NOTICE([(Your Boot JDK version must be one of:
$DEFAULT_ACCEPTABLE_BOOT_VERSIONS)])
BOOT_JDK_FOUND=no
(I've added a couple of line breaks for readability ...)
If we compare this to the actual error message:
configure: Potential Boot JDK found at /home/katya/java is incorrect JDK version
(Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true);
ignoring
So ... it looks like:
- You have (or something has) set the
_JAVA_OPTIONS
environment variable in the environment that is in effect when you runconfigure
. - The
java
command is warning you that_JAVA_OPTIONS
are in effect (for security reasons!). Presumably the real version string gets output as the next line. - The macro captures just the first line (
head -n 1
) ... and then uses the warning message as if it was the real version string. - This bogus version causes the Boot Java version checking logic to fail.
You probably have a valid Boot JDK ... but configure
has been confused by the warning message, and thinks that you don't.
Possible solutions:
Just unset
_JAVA_OPTIONS
. Those options don't look relevant to what you are doing.If the are relevant to building, unset
_JAVA_OPTIONS
while you runconfigure
. Then set it again.If there is some reason why unsetting
_JAVA_OPTIONS
won't work, you could modify the above ".m4" file to skip the version check. (Ughhh ...)
You can read more about this unwanted (though actually necessary) behavior of _JAVA_OPTIONS
in:
(And the short answer is "you can't" ... apart from unsetting the environment variable.)
Answered By - Stephen C