[java-access-bridge] Add code to check against 64-bit JVM so as to load the
- From: Ke Wang <kewang src gnome org>
- To: svn-commits-list gnome org
- Subject: [java-access-bridge] Add code to check against 64-bit JVM so as to load the
- Date: Mon, 1 Jun 2009 22:55:06 -0400 (EDT)
commit ad5d024826b6abc2a8f84b6936b88d399b1f911d
Author: Ke Wang <ke wang sun com>
Date: Tue Jun 2 10:53:29 2009 +0800
Add code to check against 64-bit JVM so as to load the
correct JNI library.
---
bridge/org/GNOME/Accessibility/JavaBridge.java | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/bridge/org/GNOME/Accessibility/JavaBridge.java b/bridge/org/GNOME/Accessibility/JavaBridge.java
index 91b60b0..1f155f8 100644
--- a/bridge/org/GNOME/Accessibility/JavaBridge.java
+++ b/bridge/org/GNOME/Accessibility/JavaBridge.java
@@ -349,9 +349,27 @@ public class JavaBridge {
try {
String javaHome = System.getProperty ("java.home");
- System.load ( javaHome + "/lib/ext/libjava-access-bridge-jni.so" );
- if (debugFlag)
- System.err.println ( javaHome + "/lib/ext/libjava-access-bridge-jni.so loaded" );
+ String jvmArch = System.getProperty ("sun.arch.data.model");
+ String osArch = System.getProperty ("os.arch");
+ String libPath = "";
+
+ if ("32".equals(jvmArch)) {
+ libPath = javaHome + "/lib/ext/libjava-access-bridge-jni.so";
+ } else if ("64".equals(jvmArch)) {
+ if ("amd64".equals(osArch)) {
+ libPath = javaHome + "/lib/ext/amd64/libjava-access-bridge-jni.so";
+ } else if ("sparcv9".equals(osArch)) {
+ libPath = javaHome + "/lib/ext/sparcv9/libjava-access-bridge-jni.so";
+ }
+ }
+
+ if (debugFlag) {
+ if (!libPath.equals("")) {
+ System.err.println ( libPath + " loaded" );
+ } else {
+ System.err.println ( "Error: jni library not found" );
+ }
+ }
}
catch (Exception ex)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]