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,
1045      * for example, L, and a native library called L is statically linked
1046      * with the native application or the VM (which itself may be statically
1047      * linked into the native application), then the JNI_OnLoad_L
1048      * function exported by the library is invoked rather than attempting
1049      * to load a dynamic library.
1050      * A filename matching the argument does not have to exist in the
1051      * file system.
1052      * See the JNI Specification for more details.
1053      * 
1054      * Otherwise, the filename argument is mapped to a native library image in 
1055      * an implementation-dependent manner.
1056      * 
1057      * <p>
1058      * The call <code>System.load(name)</code> is effectively equivalent
1059      * to the call:
1060      * <blockquote><pre>
1061      * Runtime.getRuntime().load(name)
1062      * </pre></blockquote>
1063      *
1064      * @param      filename   the file to load.
1065      * @exception  SecurityException  if a security manager exists and its
1066      *             <code>checkLink</code> method doesn't allow
1067      *             loading of the specified dynamic library
1068      * @exception  UnsatisfiedLinkError  if either the filename is not an 
1069      *             absolute path name, the native library is not statically 
1070      *             linked with the VM, or the library cannot be mapped to 
1071      *             a native library image by the host system.
1072      * @exception  NullPointerException if <code>filename</code> is
1073      *             <code>null</code>
1074      * @see        java.lang.Runtime#load(java.lang.String)
1075      * @see        java.lang.SecurityManager#checkLink(java.lang.String)
1076      */
1077     public static void load(String filename) {
1078         Runtime.getRuntime().load0(getCallerClass(), filename);
1079     }
1080 
1081     /**
1082      * Loads the native library specified by the <code>libname</code> 
1083      * argument.  The <code>libname</code> argument must not contain any platform 
1084      * specific prefix, file extension or path. If a native library 
1085      * called <code>libname</code> is statically linked with the VM, then the 
1086      * JNI_OnLoad_<code>libname</code> function exported by the library is invoked. 
1087      * See the JNI Specification for more details.
1088      *  
1089      * Otherwise, the libname argument is loaded from a system library 
1090      * location and mapped to a native library image in an implementation-
1091      * dependent manner.
1092      * <p>
1093      * The call <code>System.loadLibrary(name)</code> is effectively
1094      * equivalent to the call
1095      * <blockquote><pre>
1096      * Runtime.getRuntime().loadLibrary(name)
1097      * </pre></blockquote>
1098      *
1099      * @param      libname   the name of the library.
1100      * @exception  SecurityException  if a security manager exists and its
1101      *             <code>checkLink</code> method doesn't allow
1102      *             loading of the specified dynamic library
1103      * @exception  UnsatisfiedLinkError if either the libname argument 
1104      *             contains a file path, the native library is not statically 
1105      *             linked with the VM,  or the library cannot be mapped to a 
1106      *             native library image by the host system.
1107      * @exception  NullPointerException if <code>libname</code> is
1108      *             <code>null</code>
1109      * @see        java.lang.Runtime#loadLibrary(java.lang.String)
1110      * @see        java.lang.SecurityManager#checkLink(java.lang.String)
1111      */
1112     public static void loadLibrary(String libname) {
1113         Runtime.getRuntime().loadLibrary0(getCallerClass(), libname);
1114     }
1115 
1116     /**
1117      * Maps a library name into a platform-specific string representing
1118      * a native library.
1119      *
1120      * @param      libname the name of the library.
1121      * @return     a platform-dependent native library name.
1122      * @exception  NullPointerException if <code>libname</code> is
1123      *             <code>null</code>
1124      * @see        java.lang.System#loadLibrary(java.lang.String)
1125      * @see        java.lang.ClassLoader#findLibrary(java.lang.String)
1126      * @since      1.2