This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
How to overcome MissingResourceException (gnu.java.locale.Calendar)
- From: Martin Egholm Nielsen <martin at egholm-nielsen dot dk>
- To: java at gcc dot gnu dot org
- Date: Thu, 10 Jun 2004 11:14:04 +0200
- Subject: How to overcome MissingResourceException (gnu.java.locale.Calendar)
Hi there,
I know this problem has been up a few times - the
MissingResourceException when using java.util.Date's toString()-method.
(http://gcc.gnu.org/ml/java/2002-04/msg00186.html)
That is, having the small source-file
public class DateTest {
// private static Class _c = gnu.java.locale.Calendar.class;
public static void main(String[] args) {
System.out.println( "Date: " + new java.util.Date() );
} // main
} // DateTest
will throw a MissingResourceException when compiled with gcj-3.3 if the
commented statement is omitted.
However, since I'd like to have my source compatible with Sun's/IBM's
compiler, I hope there is a way to overcome the need for the explicit
class-reference?
In http://gcc.gnu.org/ml/java/2004-03/msg00289.html Scott Gilbertson,
addresses this issue:
=== SNIP ===
Depending on what classes you're using, you may also need some "-u"
parameters on your link line, to force it to link in classes which are
dynamically loaded in your application (or in the libraries). It's
generally easier, though to put lines like the following in one of your
Java files, which accomplishes the same thing:
private static Class cl2 = gnu.gcj.convert.Output_UTF8.class;
=== SNIP ===
but I don't quite understand how this "-u" parameter works.
Best regards,
Martin Egholm