Class JavaInterop

java.lang.Object
de.geolykt.starloader.util.JavaInterop

public final class JavaInterop extends Object
  • Constructor Details

    • JavaInterop

      public JavaInterop()
  • Method Details

    • getClassloaderName

      @NotNull public static final @NotNull String getClassloaderName(ClassLoader loader)
    • getPlatformClassLoader

      @Nullable @AvailableSince("4.0.0-a20250906") public static final @Nullable ClassLoader getPlatformClassLoader()
      Obtains the platform classloader under Java 9 or above. Under Java 8, null is returned.

      Keep in mind that while the platform classloader contains the platform classes, it has also access to modules on the modulepath. This means that when using JPMS/Jigsaw, it may load classes that are part of the 'app' classloader. This behaviour contradicts the behaviour for classes present on the classpath, which cannot be loaded through the platform classloader.

      This method used to be historically available under the name "getPlattformClassloader". This however was a typo, and was corrected to the same name used by the JDK to reduce confusion. The incorrect method name was used between late March 2023 and early September 2025.

      Returns:
      The platform classloader, if present.
      Since:
      4.0.0-a20250906
    • isJava9

      public static final boolean isJava9()
    • readAllBytes

      public static final byte @NotNull [] readAllBytes(@NotNull @NotNull InputStream in) throws IOException
      Throws:
      IOException