title: How to change the calendar to Gregorian in Thailand locale
body: <p>In my Java 8u51 application, I need to use Thailand locale.<br>
  However, I would like to use Gregorian Calendar instead of Buddhist Calendar.</p>
  
  <p>I tried to replace java.util.Calendar 's CalendarProvider with SPI, but it has not worked out.</p>
  
  <pre><code>import java.security.AccessController;
  ...
  import sun.util.locale.provider.LocaleProviderAdapter;
  import sun.util.spi.CalendarProvider;
  ...
  
  public static void main(String[] args) {
      try {
          System.out.println(AccessController.doPrivileged(new sun.security.action.GetPropertyAction("java.locale.providers")));
  
          Locale l = Locale.getDefault(Locale.Category.FORMAT);
          CalendarProvider provider = LocaleProviderAdapter.getAdapter(CalendarProvider.class, l).getCalendarProvider();
          provider.getInstance(TimeZone.getDefault(), l);
  
          LocaleProviderAdapter.getAdapterPreference().forEach(o -&gt; System.out.printf("Adapter: %s%n", o));
          System.out.printf("Provider: %s%n", provider.getClass());
          System.out.printf("Availables: %s%n", Calendar.getAvailableCalendarTypes());
          System.out.printf("Calendar: %s%n", Calendar.getInstance().getClass());
      }
      ...
  </code></pre>
  
  <p><code>src/META-INF/services/sun.util.spi.CalendarProvider</code> is as follows.</p>
  
  <pre><code>sun.util.locale.provider.AlwaysGregorianCalendarProviderImpl
  </code></pre>
  
  <p>Omit the source of AlwaysGregorianCalendarProviderImpl.<br>
  result,</p>
  
  <pre><code>$ java -jar Sample.jar -Djava.locale.providers=SPI -Duser.language=th -Duser.country=TH
  SPI
  Adapter: SPI
  Adapter: FALLBACK
  Provider: class sun.util.locale.provider.CalendarProviderImpl
  Availables: [gregory, buddhist, japanese]
  Calendar: class sun.util.BuddhistCalendar
  </code></pre>
  
  <p>Buddhist Calendar will be used.<br>
  How can I change it to a Gregorian calendar?</p>