src/share/classes/java/awt/Toolkit.java

Print this page




1629      * problem is that this means that the native libraries must be
1630      * loaded by the java.* classes, which do not necessarily know the
1631      * names of the libraries to load. A better way of doing this
1632      * would be to provide a separate library which defines java.awt.*
1633      * initIDs, and exports the relevant symbols out to the
1634      * implementation libraries.
1635      *
1636      * For now, we know it's done by the implementation, and we assume
1637      * that the name of the library is "awt".  -br.
1638      *
1639      * If you change loadLibraries(), please add the change to
1640      * java.awt.image.ColorModel.loadLibraries(). Unfortunately,
1641      * classes can be loaded in java.awt.image that depend on
1642      * libawt and there is no way to call Toolkit.loadLibraries()
1643      * directly.  -hung
1644      */
1645     private static boolean loaded = false;
1646     static void loadLibraries() {
1647         if (!loaded) {
1648             java.security.AccessController.doPrivileged(
1649                           new sun.security.action.LoadLibraryAction("awt"));





1650             loaded = true;
1651         }
1652     }
1653 
1654     static {
1655         java.security.AccessController.doPrivileged(
1656                                  new java.security.PrivilegedAction<Void>() {
1657             public Void run() {
1658                 try {
1659                     resources =
1660                         ResourceBundle.getBundle("sun.awt.resources.awt",
1661                                                  CoreResourceBundleControl.getRBControlInstance());
1662                 } catch (MissingResourceException e) {
1663                     // No resource file; defaults will be used.
1664                 }
1665                 return null;
1666             }
1667         });
1668 
1669         // ensure that the proper libraries are loaded




1629      * problem is that this means that the native libraries must be
1630      * loaded by the java.* classes, which do not necessarily know the
1631      * names of the libraries to load. A better way of doing this
1632      * would be to provide a separate library which defines java.awt.*
1633      * initIDs, and exports the relevant symbols out to the
1634      * implementation libraries.
1635      *
1636      * For now, we know it's done by the implementation, and we assume
1637      * that the name of the library is "awt".  -br.
1638      *
1639      * If you change loadLibraries(), please add the change to
1640      * java.awt.image.ColorModel.loadLibraries(). Unfortunately,
1641      * classes can be loaded in java.awt.image that depend on
1642      * libawt and there is no way to call Toolkit.loadLibraries()
1643      * directly.  -hung
1644      */
1645     private static boolean loaded = false;
1646     static void loadLibraries() {
1647         if (!loaded) {
1648             java.security.AccessController.doPrivileged(
1649                 new java.security.PrivilegedAction<Void>() {
1650                     public Void run() {
1651                         System.loadLibrary("awt");
1652                         return null;
1653                     }
1654                 });
1655             loaded = true;
1656         }
1657     }
1658 
1659     static {
1660         java.security.AccessController.doPrivileged(
1661                                  new java.security.PrivilegedAction<Void>() {
1662             public Void run() {
1663                 try {
1664                     resources =
1665                         ResourceBundle.getBundle("sun.awt.resources.awt",
1666                                                  CoreResourceBundleControl.getRBControlInstance());
1667                 } catch (MissingResourceException e) {
1668                     // No resource file; defaults will be used.
1669                 }
1670                 return null;
1671             }
1672         });
1673 
1674         // ensure that the proper libraries are loaded