[Open Office] JRE register fails when building 2.0.4 on Mandriva 2007 x86_64

Caolan McNamara caolanm at redhat.com
Thu Oct 26 05:27:04 EDT 2006


On Thu, 2006-10-26 at 11:07 +0200, Atle Nissestad wrote:

> I'm using gcj 4.1.1. It does not have libjvm.so.
> How are the library paths determined when compiling with
> --with-java=gij, then ?
> (JAVA_HOME is set to /usr inside the ooo build environment).

So then we're looking for libgcj.so...

If you save this as findhome.java

class findhome
{
        public static void main(String args[])
        {
                System.out.println(System.getProperty("java.home"));

System.out.println(System.getProperty("gnu.classpath.home.url"));
        }
}

gcj -C findhome.java
gij findhome

what does it say ?

e.g. mine (on i386) is 
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
file:///usr/lib

while on x86_64 it says...
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
file:///usr/lib64

Now the first line is java.home and the second is gnu.classpath.home.url
and in jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx we assign java.home
as m_sJavaHome and the other as m_sHome. We try m_sHome first and search
for libjvm.so and the other various libgcj.sos, and then we search under
m_sJavaHome.

If for some reason we have *no* m_sJavaHome value, we set it to a
default of /usr/lib. Depending on what you get as the results above it
might be the case that we might need to change... 

if (!m_sJavaHome.getLength())
    m_sJavaHome = "file:///usr/lib";

to

if (!m_sJavaHome.getLength())
#ifdef X86_64
    m_sJavaHome = "file:///usr/lib64";
#else
    m_sJavaHome = "file:///usr/lib";
#endif

but then we might fall afoul of gcj's on x86_64 where there isn't a
java.home set, but libgcj.so has been put into /usr/lib in which case we
might need an additional

#ifdef X86_64
    if (!bRt)
    {
        m_sHome = "file:///usr/lib64";
        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;
            }
        }
    }
#endif

after the existing last 
if (!bRt) ...

Depends on what you get from running the above java program I guess.

C.




More information about the Openoffice mailing list