src/share/classes/java/lang/System.java

Print this page




1020      * @deprecated  This method is inherently unsafe.  It may result in
1021      *      finalizers being called on live objects while other threads are
1022      *      concurrently manipulating those objects, resulting in erratic
1023      *      behavior or deadlock.
1024      * @param value indicating enabling or disabling of finalization
1025      * @throws  SecurityException
1026      *        if a security manager exists and its <code>checkExit</code>
1027      *        method doesn't allow the exit.
1028      *
1029      * @see     java.lang.Runtime#exit(int)
1030      * @see     java.lang.Runtime#gc()
1031      * @see     java.lang.SecurityManager#checkExit(int)
1032      * @since   JDK1.1
1033      */
1034     @Deprecated
1035     public static void runFinalizersOnExit(boolean value) {
1036         Runtime.runFinalizersOnExit(value);
1037     }
1038 
1039     /**
1040      * Loads a code file with the specified filename from the local file
1041      * system as a dynamic library. The filename
1042      * argument must be a complete path name.











1043      * <p>
1044      * The call <code>System.load(name)</code> is effectively equivalent
1045      * to the call:
1046      * <blockquote><pre>
1047      * Runtime.getRuntime().load(name)
1048      * </pre></blockquote>
1049      *
1050      * @param      filename   the file to load.
1051      * @exception  SecurityException  if a security manager exists and its
1052      *             <code>checkLink</code> method doesn't allow
1053      *             loading of the specified dynamic library
1054      * @exception  UnsatisfiedLinkError  if the file does not exist.



1055      * @exception  NullPointerException if <code>filename</code> is
1056      *             <code>null</code>
1057      * @see        java.lang.Runtime#load(java.lang.String)
1058      * @see        java.lang.SecurityManager#checkLink(java.lang.String)
1059      */
1060     public static void load(String filename) {
1061         Runtime.getRuntime().load0(getCallerClass(), filename);
1062     }
1063 
1064     /**
1065      * Loads the system library specified by the <code>libname</code>
1066      * argument. The manner in which a library name is mapped to the
1067      * actual system library is system dependent.







1068      * <p>
1069      * The call <code>System.loadLibrary(name)</code> is effectively
1070      * equivalent to the call
1071      * <blockquote><pre>
1072      * Runtime.getRuntime().loadLibrary(name)
1073      * </pre></blockquote>
1074      *
1075      * @param      libname   the name of the library.
1076      * @exception  SecurityException  if a security manager exists and its
1077      *             <code>checkLink</code> method doesn't allow
1078      *             loading of the specified dynamic library
1079      * @exception  UnsatisfiedLinkError  if the library does not exist.



1080      * @exception  NullPointerException if <code>libname</code> is
1081      *             <code>null</code>
1082      * @see        java.lang.Runtime#loadLibrary(java.lang.String)
1083      * @see        java.lang.SecurityManager#checkLink(java.lang.String)
1084      */
1085     public static void loadLibrary(String libname) {
1086         Runtime.getRuntime().loadLibrary0(getCallerClass(), libname);
1087     }
1088 
1089     /**
1090      * Maps a library name into a platform-specific string representing
1091      * a native library.
1092      *
1093      * @param      libname the name of the library.
1094      * @return     a platform-dependent native library name.
1095      * @exception  NullPointerException if <code>libname</code> is
1096      *             <code>null</code>
1097      * @see        java.lang.System#loadLibrary(java.lang.String)
1098      * @see        java.lang.ClassLoader#findLibrary(java.lang.String)
1099      * @since      1.2




1020      * @deprecated  This method is inherently unsafe.  It may result in
1021      *      finalizers being called on live objects while other threads are
1022      *      concurrently manipulating those objects, resulting in erratic
1023      *      behavior or deadlock.
1024      * @param value indicating enabling or disabling of finalization
1025      * @throws  SecurityException
1026      *        if a security manager exists and its <code>checkExit</code>
1027      *        method doesn't allow the exit.
1028      *
1029      * @see     java.lang.Runtime#exit(int)
1030      * @see     java.lang.Runtime#gc()
1031      * @see     java.lang.SecurityManager#checkExit(int)
1032      * @since   JDK1.1
1033      */
1034     @Deprecated
1035     public static void runFinalizersOnExit(boolean value) {
1036         Runtime.runFinalizersOnExit(value);
1037     }
1038 
1039     /**
1040      * Loads the native library specified by the filename argument.  The filename 
1041      * argument must be an absolute path name.
1042      *  
1043      * If the filename argument, when stripped of any platform-specific library 
1044      * prefix, path, and file extension, indicates a library whose name is L, 
1045      * and a native library called L is statically linked with the VM, then the 
1046      * JNI_OnLoad_L function exported by the library is invoked rather than 
1047      * attempting to load a dynamic library.  A filename matching the argument 
1048      * does not have to exist in the file system.   See the JNI Specification 
1049      * for more details.
1050      * 
1051      * Otherwise, the filename argument is mapped to a native library image in 
1052      * an implementation-dependent manner.
1053      * 
1054      * <p>
1055      * The call <code>System.load(name)</code> is effectively equivalent
1056      * to the call:
1057      * <blockquote><pre>
1058      * Runtime.getRuntime().load(name)
1059      * </pre></blockquote>
1060      *
1061      * @param      filename   the file to load.
1062      * @exception  SecurityException  if a security manager exists and its
1063      *             <code>checkLink</code> method doesn't allow
1064      *             loading of the specified dynamic library
1065      * @exception  UnsatisfiedLinkError  if either the filename is not an 
1066      *             absolute path name, the native library is not statically 
1067      *             linked with the VM, or the library cannot be mapped to 
1068      *             a native library image by the host system.
1069      * @exception  NullPointerException if <code>filename</code> is
1070      *             <code>null</code>
1071      * @see        java.lang.Runtime#load(java.lang.String)
1072      * @see        java.lang.SecurityManager#checkLink(java.lang.String)
1073      */
1074     public static void load(String filename) {
1075         Runtime.getRuntime().load0(getCallerClass(), filename);
1076     }
1077 
1078     /**
1079      * Loads the native library specified by the <code>libname</code> 
1080      * argument.  The <code>libname</code> argument must not contain any platform 
1081      * specific prefix, file extension or path. If a native library 
1082      * called <code>libname</code> is statically linked with the VM, then the 
1083      * JNI_OnLoad_<code>libname</code> function exported by the library is invoked. 
1084      * See the JNI Specification for more details.
1085      *  
1086      * Otherwise, the libname argument is loaded from a system library 
1087      * location and mapped to a native library image in an implementation-
1088      * dependent manner.
1089      * <p>
1090      * The call <code>System.loadLibrary(name)</code> is effectively
1091      * equivalent to the call
1092      * <blockquote><pre>
1093      * Runtime.getRuntime().loadLibrary(name)
1094      * </pre></blockquote>
1095      *
1096      * @param      libname   the name of the library.
1097      * @exception  SecurityException  if a security manager exists and its
1098      *             <code>checkLink</code> method doesn't allow
1099      *             loading of the specified dynamic library
1100      * @exception  UnsatisfiedLinkError if either the libname argument 
1101      *             contains a file path, the native library is not statically 
1102      *             linked with the VM,  or the library cannot be mapped to a 
1103      *             native library image by the host system.
1104      * @exception  NullPointerException if <code>libname</code> is
1105      *             <code>null</code>
1106      * @see        java.lang.Runtime#loadLibrary(java.lang.String)
1107      * @see        java.lang.SecurityManager#checkLink(java.lang.String)
1108      */
1109     public static void loadLibrary(String libname) {
1110         Runtime.getRuntime().loadLibrary0(getCallerClass(), libname);
1111     }
1112 
1113     /**
1114      * Maps a library name into a platform-specific string representing
1115      * a native library.
1116      *
1117      * @param      libname the name of the library.
1118      * @return     a platform-dependent native library name.
1119      * @exception  NullPointerException if <code>libname</code> is
1120      *             <code>null</code>
1121      * @see        java.lang.System#loadLibrary(java.lang.String)
1122      * @see        java.lang.ClassLoader#findLibrary(java.lang.String)
1123      * @since      1.2