< prev index next >
src/java.base/share/classes/java/lang/Runtime.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, Azul Systems, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
@@ -34,10 +34,11 @@
import java.util.List;
import java.util.Optional;
import java.util.StringTokenizer;
import jdk.internal.access.SharedSecrets;
+import jdk.internal.loader.NativeLibrary;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
/**
* Every Java application has a single instance of class
@@ -731,20 +732,21 @@
@CallerSensitive
public void load(String filename) {
load0(Reflection.getCallerClass(), filename);
}
- void load0(Class<?> fromClass, String filename) {
+ NativeLibrary load0(Class<?> fromClass, String filename) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(filename);
}
- if (!(new File(filename).isAbsolute())) {
+ File file = new File(filename);
+ if (!file.isAbsolute()) {
throw new UnsatisfiedLinkError(
"Expecting an absolute path of the library: " + filename);
}
- ClassLoader.loadLibrary(fromClass, filename, true);
+ return ClassLoader.loadLibrary(fromClass, file);
}
/**
* Loads the native library specified by the {@code libname}
* argument. The {@code libname} argument must not contain any platform
@@ -793,20 +795,20 @@
@CallerSensitive
public void loadLibrary(String libname) {
loadLibrary0(Reflection.getCallerClass(), libname);
}
- void loadLibrary0(Class<?> fromClass, String libname) {
+ NativeLibrary loadLibrary0(Class<?> fromClass, String libname) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkLink(libname);
}
if (libname.indexOf((int)File.separatorChar) != -1) {
throw new UnsatisfiedLinkError(
"Directory separator should not appear in library name: " + libname);
}
- ClassLoader.loadLibrary(fromClass, libname, false);
+ return ClassLoader.loadLibrary(fromClass, libname);
}
/**
* Returns the version of the Java Runtime Environment as a {@link Version}.
*
< prev index next >