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

João Garcia jgarcia@uk2.net
Fri Jun 11 11:48:00 GMT 2004


Martin Egholm Nielsen wrote:
>>Martin> // private static Class _c = gnu.java.locale.Calendar.class;
>>>Well, the final target will be a PPC405 running Linux, but in the 
>transition phase between using IBM's J9 and GCJ, I'm compiling on 
>Windows/Cygwin... But maybe that's not a good idea...
>>>>Why don't you try something like this:
private static Class _c = 
 System.getProperty("java.vendor","").equals("Free Software Foundation, Inc.") ? 
 gnu.java.locale.Calendar.class : null;
You will have to include libgcj-<x.y.z>.jar in classpath when compiling to 
bytecode. But the bytecode should run fine, using a Standard JVM, without that 
jar in its classpath.
At least I have tested it with the folloing class, and it worked:
public class TestClass {
	
	private static Class _c = System.getProperty(
		"java.vendor","").equals("Free Software Foundation, Inc.") ? 
		gnu.java.locale.Calendar.class : null;
	
	public static void main(String[] args) {
		Date date=new Date();
		System.out.println(Integer.toString(1900+date.getYear()));				
	}
}
The bytecode test was made, using Sun's JVM, like this:
java -classpath . TestClass
libgcj-<x.y.z>.jar was not in current directory, and it was not in the Sun's stuff, 
so I think it is safe to say that it was not in the classpath.
I hope this helps...
Regards,
Joao


More information about the Java mailing list

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