From b7ba2faedca92f3fb1e7bd131eb1aac1f74bba85 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 15 Feb 2022 12:12:01 +0100 Subject: [PATCH] Clean up jre usages. --- .../org/graalvm/home/impl/DefaultHomeFinder.java | 14 +++++--------- .../src/org/graalvm/launcher/Launcher.java | 15 +++++---------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/sdk/src/org.graalvm.home/src/org/graalvm/home/impl/DefaultHomeFinder.java b/sdk/src/org.graalvm.home/src/org/graalvm/home/impl/DefaultHomeFinder.java index eccc016dec71..89644e608a45 100644 --- a/sdk/src/org.graalvm.home/src/org/graalvm/home/impl/DefaultHomeFinder.java +++ b/sdk/src/org.graalvm.home/src/org/graalvm/home/impl/DefaultHomeFinder.java @@ -362,13 +362,13 @@ private static Path getGraalVmHomeFromRelativeLauncherPath(Path executableOrObjF } /** - * Fallback for the GraalVM home using location of libpolyglot in jdk/jre layout. + * Fallback for the GraalVM home using location of libpolyglot in jdk layout. * * @param objectFile the path to libpolyglot * @return the path to GraalVM home or null */ private static Path getGraalVmHomeLibPolyglotFallBack(Path objectFile) { - // /jre/lib/polyglot/libpolyglot.so + // /lib/polyglot/libpolyglot.so Path parent = objectFile.getParent(); if (parent == null || !"polyglot".equals(getFileName(parent))) { return null; @@ -378,13 +378,9 @@ private static Path getGraalVmHomeLibPolyglotFallBack(Path objectFile) { return null; } Path home = null; - Path jreOrJdk = parent.getParent(); - if (jreOrJdk != null) { - if ("jre".equals(getFileName(jreOrJdk))) { - home = jreOrJdk.getParent(); - } else { - home = jreOrJdk; - } + Path jdk = parent.getParent(); + if (jdk != null) { + home = jdk; } return home != null && isJdkHome(home) ? home : null; } diff --git a/sdk/src/org.graalvm.launcher/src/org/graalvm/launcher/Launcher.java b/sdk/src/org.graalvm.launcher/src/org/graalvm/launcher/Launcher.java index ae89be699956..a415927cd71c 100644 --- a/sdk/src/org.graalvm.launcher/src/org/graalvm/launcher/Launcher.java +++ b/sdk/src/org.graalvm.launcher/src/org/graalvm/launcher/Launcher.java @@ -561,8 +561,8 @@ protected Path getGraalVMHome() { } /** - * Returns filename of the binary, depending on OS. Binary will be searched in {@code bin} or - * {@code jre/bin} directory. + * Returns filename of the binary, depending on OS. Binary will be searched in {@code bin} + * directory. * * @param binaryName binary name, without path. * @return OS-dependent binary filename. @@ -574,14 +574,9 @@ protected final Path getGraalVMBinaryPath(String binaryName) { throw abort("Cannot exec to GraalVM binary: could not find GraalVM home"); } for (String executableName : executableNames) { - Path[] execPaths = new Path[]{ - graalVMHome.resolve("bin").resolve(executableName), - graalVMHome.resolve("jre").resolve("bin").resolve(executableName) - }; - for (Path execPath : execPaths) { - if (Files.exists(execPath)) { - return execPath; - } + Path execPath = graalVMHome.resolve("bin").resolve(executableName); + if (Files.exists(execPath)) { + return execPath; } } throw abort("Cannot exec to GraalVM binary: could not find a '" + binaryName + "' executable");