< prev index next >

src/java.base/share/classes/java/lang/Runtime.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1995, 2019, 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 --- 1,7 ---- /* ! * 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,43 **** --- 34,44 ---- 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,750 **** @CallerSensitive public void load(String filename) { load0(Reflection.getCallerClass(), filename); } ! void load0(Class<?> fromClass, String filename) { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkLink(filename); } ! if (!(new File(filename).isAbsolute())) { throw new UnsatisfiedLinkError( "Expecting an absolute path of the library: " + filename); } ! ClassLoader.loadLibrary(fromClass, filename, true); } /** * Loads the native library specified by the {@code libname} * argument. The {@code libname} argument must not contain any platform --- 732,752 ---- @CallerSensitive public void load(String filename) { load0(Reflection.getCallerClass(), filename); } ! NativeLibrary load0(Class<?> fromClass, String filename) { SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkLink(filename); } ! File file = new File(filename); ! if (!file.isAbsolute()) { throw new UnsatisfiedLinkError( "Expecting an absolute path of the library: " + filename); } ! 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,812 **** @CallerSensitive public void loadLibrary(String libname) { loadLibrary0(Reflection.getCallerClass(), libname); } ! void 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); } /** * Returns the version of the Java Runtime Environment as a {@link Version}. * --- 795,814 ---- @CallerSensitive public void loadLibrary(String libname) { loadLibrary0(Reflection.getCallerClass(), 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); } ! return ClassLoader.loadLibrary(fromClass, libname); } /** * Returns the version of the Java Runtime Environment as a {@link Version}. *
< prev index next >