Re: Problems using a compiled jar with gcj

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/10/2010 05:51 PM, Lothar Werzinger wrote:
> On Tuesday, August 10, 2010, Andrew Haley wrote:
>> You are trying to redefine one of gcj's core classes,
>> sun.reflect.Reflection.  This is never going to work, no matter what
>> combination of options you try to use: the compiled binary interface
>> requires core classes to be unique.
>>
>> So, I removed the classes that already exist in libgcj, and it gets
>> much further.
> 
> oops. don't remember where I got that jar file, but the ReflectionHack was to 
> avoid errors like:
> 
> undefined reference to `hidden alias for java::lang::Class* 
> sun::reflect::Reflection::getCallerClass(int)'
> 
> from the classes in the jar file.

That didn't happen when I did it.

> I downloaded the reference implementation of JSR 223 and I extract the javax 
> part (as I get other "undefined reference to `hidden alias" errors if I use 
> the extracted script.jar from the reference implementation of JSR 223 as you 
> can see when you run my script).
> 
> Now the SIGSEGV is gone. Thanks!
> 
> 
>> You have to call JvAttachCurrentThread.
> 
> oops I missed that when I created the test case from my real application.
> 
>> -findirect-dispatch -fno-indirect-classes is correct.
> 
> That's what I reasoned after a vast research on the net.
> 
> However now I do get a "java.lang.NoClassDefFoundError: 
> javax.script.ScriptEngineManager" Error.

I get

 $ LD_LIBRARY_PATH=.:/home/aph/gcc/trunk/install/lib64/ ./testgcj2
testgcj
Create JavaVM ...
Create JavaVM done.
java.lang.NullPointerException
   <<No stacktrace available>>

The NullPointerException happens because j_scriptEngineManager->getEngineByName()
returns null.

> I would expect a NoClassDefFoundError for the jython script engine itself, as 
> I did not provide it on the classpath, but ScriptEngineManager is in the 
> shared library compiled from the jar, so why do I get a NoClassDefFoundError?

You need to compile your main program -fPIC.

If you really want to know why, I can explain...  :-)

Andrew.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux