104 Dl_info dlinfo;
105 char buf[MAXPATHLEN];
106 int32_t len;
107 char *p, *tk;
108 JNI_OnLoad_type *JNI_OnLoad_ptr;
109 struct utsname name;
110 JNIEnv *env = (JNIEnv *)JNU_GetEnv(vm, JNI_VERSION_1_2);
111 void *v;
112 jstring fmanager = NULL;
113 jstring fmProp = NULL;
114
115 if (awtHandle != NULL) {
116 /* Avoid several loading attempts */
117 return JNI_VERSION_1_2;
118 }
119
120 jvm = vm;
121
122 /* Get address of this library and the directory containing it. */
123 dladdr((void *)AWT_OnLoad, &dlinfo);
124 realpath((char *)dlinfo.dli_fname, buf);
125 len = strlen(buf);
126 p = strrchr(buf, '/');
127
128 /*
129 * The code below is responsible for:
130 * 1. Loading appropriate awt library, i.e. libawt_xawt or libawt_headless
131 * 2. Set the "sun.font.fontmanager" system property.
132 */
133
134 fmProp = (*env)->NewStringUTF(env, "sun.font.fontmanager");
135 CHECK_EXCEPTION_FATAL(env, "Could not allocate font manager property");
136
137 #ifdef MACOSX
138 fmanager = (*env)->NewStringUTF(env, "sun.font.CFontManager");
139 tk = LWAWT_PATH;
140 #else
141 fmanager = (*env)->NewStringUTF(env, "sun.awt.X11FontManager");
142 tk = XAWT_PATH;
143 #endif
144 CHECK_EXCEPTION_FATAL(env, "Could not allocate font manager name");
|
104 Dl_info dlinfo;
105 char buf[MAXPATHLEN];
106 int32_t len;
107 char *p, *tk;
108 JNI_OnLoad_type *JNI_OnLoad_ptr;
109 struct utsname name;
110 JNIEnv *env = (JNIEnv *)JNU_GetEnv(vm, JNI_VERSION_1_2);
111 void *v;
112 jstring fmanager = NULL;
113 jstring fmProp = NULL;
114
115 if (awtHandle != NULL) {
116 /* Avoid several loading attempts */
117 return JNI_VERSION_1_2;
118 }
119
120 jvm = vm;
121
122 /* Get address of this library and the directory containing it. */
123 dladdr((void *)AWT_OnLoad, &dlinfo);
124 char* res = realpath((char *)dlinfo.dli_fname, buf);
125 (void)res;
126 len = strlen(buf);
127 p = strrchr(buf, '/');
128
129 /*
130 * The code below is responsible for:
131 * 1. Loading appropriate awt library, i.e. libawt_xawt or libawt_headless
132 * 2. Set the "sun.font.fontmanager" system property.
133 */
134
135 fmProp = (*env)->NewStringUTF(env, "sun.font.fontmanager");
136 CHECK_EXCEPTION_FATAL(env, "Could not allocate font manager property");
137
138 #ifdef MACOSX
139 fmanager = (*env)->NewStringUTF(env, "sun.font.CFontManager");
140 tk = LWAWT_PATH;
141 #else
142 fmanager = (*env)->NewStringUTF(env, "sun.awt.X11FontManager");
143 tk = XAWT_PATH;
144 #endif
145 CHECK_EXCEPTION_FATAL(env, "Could not allocate font manager name");
|