Re: java extensions

Jeroen Frijters <[email protected]> Fri, 21 Aug 2015 12:18:52 +0000
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <[email protected]>
Hi,

I haven't tried it (I couldn't download the ICU jars, the site was down or something), but it might work if you add the ICU assemblies to the "boot classpath" using:

ikvm.runtime.Startup.addBootClassPathAssemby(...)

Regards,
Jeroen

> -----Original Message-----
> From: Steven Van Loon [mailto:[email protected]]
> Sent: Thursday, August 20, 2015 17:48
> To: [email protected]
> Subject: [Ikvm-developers] java extensions
> 
> Hi,
> 
> I'm trying to use icu4j (http://site.icu-project.org/) in a .net
> application using ikvm. What I need to do in java, is to add the icu
> jars (icu4j-55.1.jar and icu4j-localespi-55_1-20150610.jar) to the
> lib/ext folder and then the following (java) code will output in
> Afrikaans (not supported by the standard java platform):
> 
> java.text.DateFormat df =
> java.text.DateFormat.getDateInstance(java.text.DateFormat.LONG, new
> java.util.Locale("af", "ZA")); System.out.println(df.format(new
> java.util.Date()));
> 
> icu4j works with the java extension mechanism.
> 
> What I did next, was to convert the icu4j jars to dll's using ikvm and
> referenced them in my application. However, I can't get the following
> (c#) code to do what it does in java:
> 
> java.text.DateFormat df =
> java.text.DateFormat.getDateInstance(java.text.DateFormat.LONG, new
> java.util.Locale("af", "ZA")); System.Console.WriteLine(df.format(new
> java.util.Date()));
> 
> I keeps outputting in the default locale.
> 
> Now, is there a known way to get the locale-sensitive services to work
> in ikvm?
> 
> I'm using ikvm 7.2.4630.5.
> 
> 
> What I already did:
> I discovered that in the search of the DateFormat in
> DateFormat.getDateInstance(...), eventually,
> [c#]java.util.ServiceLoader.loadInstalled(typeof(java.text.spi.DateForma
> tProvider)) is called. When I call this method manually and iterate over
> it, it returns no results. When I create an instance of
> com.ibm.icu.impl.javaspi.text.DateFormatProviderICU (the class
> implementing DateFormat in the icu lib), the iterator does return
> something.
> 
>             com.ibm.icu.impl.javaspi.text.DateFormatProviderICU dfi =
> new com.ibm.icu.impl.javaspi.text.DateFormatProviderICU();
> 
>             ServiceLoader ldr =
> java.util.ServiceLoader.loadInstalled(typeof(java.text.spi.DateFormatPro
> vider));
> 
>             Iterator iter = ldr.iterator();
>             while(iter.hasNext())
>             {
>                 java.text.spi.DateFormatProvider dfp =
> (java.text.spi.DateFormatProvider)iter.next();
>                 Console.WriteLine(dfp.toString());
>             }
> 
> However, the code still won't output the date in Afrikaans. (Also, next
> message is found on stdout "Exception thrown:
> 'java.util.MissingResourceException' in icu4j.dll". ) I guess I can
> manually load a bunch of classes and maybe get it to work, however, I
> would think this is not the way to go.
> 
> Thanks,
> Best regards,
> Steven.
> 
> ------------------------------------------------------------------------
> ------
> _______________________________________________
> Ikvm-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ikvm-developers

------------------------------------------------------------------------------