Package de.geolykt.starloader.util
Class JavaInterop
java.lang.Object
de.geolykt.starloader.util.JavaInterop
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final @NotNull StringgetClassloaderName(ClassLoader loader) static final @Nullable ClassLoaderObtains the platform classloader under Java 9 or above.static final booleanisJava9()static final byte @NotNull []readAllBytes(@NotNull InputStream in)
-
Constructor Details
-
JavaInterop
public JavaInterop()
-
-
Method Details
-
getClassloaderName
-
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,nullis 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
-