This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: MissingResourceException with Date under mingw port
- From: Adam Megacz <gcj at lists dot megacz dot com>
- To: java at gcc dot gnu dot org
- Date: 10 Apr 2002 10:26:59 -0700
- Subject: Re: MissingResourceException with Date under mingw port
- Organization: Myself
- References: <20020410131202.C24689@dreammechanics.com>
Adam King <aking@dreammechanics.com> writes:
> Exception in thread "main" java.util.MissingResourceException:
> Bundle gnu.java.locale.Calendar not found
Yeah, the linkage between java.util.Date and gnu.java.locale.Calendar
is weak -- Date only references Calendar via reflection. GNU ld
doesn't understand this sort of linkage, so it doesn't include
gnu.java.locale.Calendar when creating a static binary.
Here's the standard prelude I throw into all my gcj programs to force
the linker to include all the required classes:
// static references to these classes ensure that the linker will include them
private static Class c1 = gnu.java.locale.Calendar.class;
private static Class c2 = java.util.GregorianCalendar.class;
private static Class c3 = gnu.gcj.convert.Input_ASCII.class;
private static Class c4 = gnu.gcj.convert.Input_UTF8.class;
private static Class c5 = gnu.gcj.convert.Input_8859_1.class;
private static Class c6 = gnu.java.locale.LocaleInformation.class;
private static Class c7 = gnu.gcj.convert.Output_ASCII.class;
To the other GCJ people: are there any disadvantages to putting
private static foo.class references in the java.* classes so that
static links work properly without this hack?
> It runs fine when compiled with the linux target.
Probably because you're dynamically linking against libgcj.so, which
includes the whole Java library. If you compile with --static you
should see the same problem on Linux.
- a
--
The web is dead; long live the Internet.
http://www.xwt.org/