Hi JBO,
> I don't think java-config is used if you have JAVA_HOME defined right ?
> (it's what I have on my systems).
You are using Gentoo / have a readable file "/etc/gentoo-release" and
you also did not install the system wide java support?
What a remarkable coincidence.
I wonder why it is working on your system.
My reading of the scripts indicates the problem should exist in this
constellation.
Please have a look at the output following information:
Here my current JAVA_HOME:
===
$ echo $JAVA_HOME
/home/rathgeb/bin/pkgs/java/jdk/8/current
===
As you can see java is part of the PATH
===
$ command -v java
/home/rathgeb/bin/pkgs/java/jdk/8/current/bin/java
===
The current java version is
===
$ java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
===
Now let's start Karaf
===
$ bin/karaf
/home/rathgeb/workspace/projects-oss/karaf/bin/apache-karaf-4.3.0-SNAPSHOT/bin/inc:
line 198: java-config: command not found
karaf: JAVA_HOME not set; results may vary
karaf: Enabling Java debug options:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
Listening for transport dt_socket at address: 5005
__ __ ____
/ //_/____ __________ _/ __/
/ ,< / __ `/ ___/ __ `/ /_
/ /| |/ /_/ / / / /_/ / __/
/_/ |_|\__,_/_/ \__,_/_/
Apache Karaf (4.3.0-SNAPSHOT)
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
karaf@root()>
===
You see the message
===
/home/rathgeb/workspace/projects-oss/karaf/bin/apache-karaf-4.3.0-SNAPSHOT/bin/inc:
line 198: java-config: command not found
===
So, please have a look at:
https://github.com/apache/karaf/blob/8c3dda1/assemblies/features/base/src/main/filtered-resources/resources/bin/inc#L187-L217
===
if [ "x${JAVA}" = "x" ] && [ -r /etc/gentoo-release ] ; then
JAVA_HOME=$(java-config --jre-home)
fi
===
If the environment JAVA is not set (AFAIK this is not a commonly used
one) and there is a readable "/etc/gentoo-release" file, JAVA_HOME is
set by using "java-config" -- regardless if the tool is present.
The "locateJava" method is called by e.g. the init method of Karaf.
> but you can define JAVA_HOME in bin/inc right ?
Sure, I can modify "bin/inc" all the time I unpack the official distribution.
But is this what you would like to tell users?
e.g. "If you unpack the official distribution and use Gentoo without
"java-config" present, please edit the "bin/inc" file in front of
starting karaf."
I don't think this is nice if we could modify the script so no
interaction is necessary.