Can't get Throwable.printStackTrace when statically linked
Andrew Haley
aph@redhat.com
Fri Nov 22 12:48:00 GMT 2002
Scott Gilbertson writes:
> I don't get stack dumps when there's a Java exception in my
> statically-linked binary (works fine in dynamic linked version). The
> following backtrace is from a core file generated from a Java exception.
> Since there's no stack dump printed, I don't know the original cause of the
> exception.
You've got a crash _inside_ glibc's shared library loader. This
shouldn't happen. I don't know what the cause might be, but it might
be to do with calling the shared library loader from a statically
linked application.
gcc's backtrace can't cope with this situation.
> I see the following line in UnicodeToBytes.java:
> String className = "gnu.gcj.convert.Output_" + encoding;
> so I assume it's failing to find Output_something.class.
>
> Does anyone know a simple way to ensure that all the classes I need are in
> the executable, or do I just have to add "-u" entries to my link arguments
> whenever I find one missing?
This is fairly unusual, and only happens when using Class.forname().
Yes, you'll have to use "-u" for this.
Java is a very dynamic language, much more than C or C++. Linking
statically is hard. If you really want to do this, okay, but you're
going to have problems like this one.
Andrew.
More information about the Java
mailing list