How to overcome MissingResourceException (gnu.java.locale.Calendar)

Martin Egholm Nielsen martin@egholm-nielsen.dk
Thu Jun 10 09:14:00 GMT 2004


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


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /