--- jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx.old	2007-08-10 17:32:26.000000000 +0200
+++ jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx	2007-08-16 22:40:42.000000000 +0200
@@ -78,6 +78,7 @@ char const* const* GnuInfo::getJavaExePa
 char const* const* GnuInfo::getRuntimePaths(int * size)
 {
     static char const* ar[]= {
+          "/libjvm.so",
           "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so",
           "/gcj-4.2.0/libjvm.so",
           "/gcj-4.2.1/libjvm.so",
@@ -104,6 +105,7 @@ bool GnuInfo::initialize(vector<pair<OUS
     //javax.accessibility.assistive_technologies from system properties
     
     OUString sVendor;
+    OUString sJavaLibraryPath;
     typedef vector<pair<OUString, OUString> >::const_iterator it_prop;
     OUString sVendorProperty(
         RTL_CONSTASCII_USTRINGPARAM("java.vendor"));
@@ -111,6 +113,8 @@ bool GnuInfo::initialize(vector<pair<OUS
         RTL_CONSTASCII_USTRINGPARAM("java.version"));
     OUString sJavaHomeProperty(
         RTL_CONSTASCII_USTRINGPARAM("java.home"));
+    OUString sJavaLibraryPathProperty(
+        RTL_CONSTASCII_USTRINGPARAM("java.library.path"));
     OUString sGNUHomeProperty(
         RTL_CONSTASCII_USTRINGPARAM("gnu.classpath.home.url"));
     OUString sAccessProperty(
@@ -120,8 +124,9 @@ bool GnuInfo::initialize(vector<pair<OUS
     bool bVendor = false;
     bool bHome = false;
     bool bJavaHome = false;
+    bool bJavaLibraryPath = false;
     bool bAccess = false;
-    
+
     typedef vector<pair<OUString, OUString> >::const_iterator it_prop;
     for (it_prop i = props.begin(); i != props.end(); i++)
     {
@@ -156,6 +161,12 @@ bool GnuInfo::initialize(vector<pair<OUS
                }
            }
         }
+        else if (!bJavaLibraryPath && sJavaLibraryPathProperty.equals(i->first))
+        {
+            sal_Int32 nIndex = 0;
+            osl_getFileURLFromSystemPath(i->second.getToken(0, ':', nIndex).pData, &sJavaLibraryPath.pData);
+            bJavaLibraryPath = true;
+        }
         else if (!bAccess && sAccessProperty.equals(i->first))
         {
             if (i->second.getLength() > 0)
@@ -216,6 +227,25 @@ bool GnuInfo::initialize(vector<pair<OUS
         }
     }
 
+    // try to find it by the java.library.path property
+    if (!bRt && m_sJavaHome != sJavaLibraryPath)
+    {
+        m_sHome = sJavaLibraryPath;
+        for(i_path ip = libpaths.begin(); ip != libpaths.end(); ip++)
+        {
+            //Construct an absolute path to the possible runtime
+            OUString usRt= m_sHome + *ip;
+            DirectoryItem item;
+            if(DirectoryItem::get(usRt, item) == File::E_None)
+            {
+                //found runtime lib
+                m_sRuntimeLibrary = usRt;
+                bRt = true;
+                break;
+            }
+        }
+    }
+
 #ifdef X86_64
     //Make one last final legacy attempt on x86_64 in case the distro placed it in lib64 instead
     if (!bRt && m_sJavaHome != rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///usr/lib")))
