in atomos.utils/atomos.utils.substrate.impl/src/main/java/org/apache/felix/atomos/utils/substrate/impl/NativeImageCliUtil.java [105:159]
public static Optional<Path> findNativeImageExecutable(final Path path)
{
if (path == null)
{
Optional<Path> oExec = findNativeImageExecutable(Paths.get(EXECUTABLE));
if (oExec.isPresent())
{
return oExec;
}
if (System.getenv(GRAALVM_HOME) != null)
{
oExec = findNativeImageExecutable(Paths.get(System.getenv(GRAALVM_HOME)));
if (oExec.isPresent())
{
return oExec;
}
}
if (System.getProperty(JAVA_HOME) != null)
{
oExec = findNativeImageExecutable(
Paths.get(System.getProperty(JAVA_HOME)));
if (oExec.isPresent())
{
return oExec;
}
}
return Optional.empty();
}
else if (!Files.exists(path))
{
return Optional.empty();
}
else if (Files.isDirectory(path))
{
final Optional<Path> candidate = findNativeImageExecutable(
path.resolve(EXECUTABLE));
if (candidate.isPresent())
{
return candidate;
}
return findNativeImageExecutable(path.resolve("bin"));
}
else //file o
{
final String version = getVersion(path);
if (version != null)
{
return Optional.of(path);
}
}
return Optional.empty();
}