KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > event > NativeLibLoader


1 /*
2  * @(#)NativeLibLoader.java 1.9 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt.event;
9
10 class NativeLibLoader {
11
12     /**
13      * This is copied from java.awt.Toolkit since we need the library
14      * loaded in sun.awt.image also:
15      *
16      * WARNING: This is a temporary workaround for a problem in the
17      * way the AWT loads native libraries. A number of classes in this
18      * package (sun.awt.image) have a native method, initIDs(),
19      * which initializes
20      * the JNI field and method ids used in the native portion of
21      * their implementation.
22      *
23      * Since the use and storage of these ids is done by the
24      * implementation libraries, the implementation of these method is
25      * provided by the particular AWT implementations (for example,
26      * "Toolkit"s/Peer), such as Motif, Microsoft Windows, or Tiny. The
27      * problem is that this means that the native libraries must be
28      * loaded by the java.* classes, which do not necessarily know the
29      * names of the libraries to load. A better way of doing this
30      * would be to provide a separate library which defines java.awt.*
31      * initIDs, and exports the relevant symbols out to the
32      * implementation libraries.
33      *
34      * For now, we know it's done by the implementation, and we assume
35      * that the name of the library is "awt". -br.
36      */

37     static void loadLibraries() {
38     java.security.AccessController.doPrivileged(
39         new sun.security.action.LoadLibraryAction("awt"));
40     }
41 }
42
Popular Tags