Ubuntu上的非法模式字符'Y' [英] Illegal pattern character 'Y' on Ubuntu

查看:209
本文介绍了Ubuntu上的非法模式字符'Y'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows中使用此模式 SimpleDateFormat format = new SimpleDateFormat(YYYY-MM-dd HH:mm:ss); 并且它可以工作,但是在尝试时Ubuntu 10.04它显示异常 play.exceptions.JavaExecutionException:非法模式字符'Y'

I use this pattern SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss"); in windows and it works, but when try on Ubuntu 10.04 it show an exception play.exceptions.JavaExecutionException: Illegal pattern character 'Y'.

我搜索解决方案,发现年份模式必须改为小写:
SimpleDateFormat format = new SimpleDateFormat(yyyy-MM-dd HH:mm:ss); 并且它有效。

I search for solution for this and found the year pattern must be change to lower-case: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); and it works.

任何人都可以告诉我这个原因背后的原因在Windows工作但是如果我使用'Y在Ubuntu中不起作用'而不是'y'?

注意:


  1. Play-1.2.3

  2. JRE:
  1. Play-1.2.3
  2. JRE:

  1. Windows: java version1.7.0_03
    Java(TM)SE运行时环境(版本1.7.0_03-b05)
    Java HotSpot(TM)客户端VM(版本22.1-b02,混合模式,共享)

  2. Ubuntu: java版本1.6.0_31
    Java(TM)SE运行时En vironment(build 1.6.0_31-b04)
    Java HotSpot(TM)64位服务器VM(版本20.6-b01,混合模式)

  1. Windows: java version "1.7.0_03" Java(TM) SE Runtime Environment (build 1.7.0_03-b05) Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode, sharing)
  2. Ubuntu: java version "1.6.0_31" Java(TM) SE Runtime Environment (build 1.6.0_31-b04) Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)


  • Windows 7

  • Ubuntu 10.04

  • 更新24/05/2012

    在我的系统中再次检查后,有3个JRE和我的Windows默认使用JRE1.7。但对于Play我使用JRE1.6设置运行。

    After I check again in my system, there is 3 JRE and my windows using JRE1.7 for default. But for Play I set running using JRE1.6.

    推荐答案

    我搜索SimpleDateFormat并得到 doc

    I search for SimpleDateFormat and got the doc from oracle.

    在我的窗口中工作,因为我将默认JRE设置为1.7,但仍然使用JRE1.6为Play Framework运行。

    Works in my windows because I set the default JRE to 1.7 but still running using JRE1.6 for the Play Framework.

    因此在Windows上运行,JRE1.7已添加' Y'模式为周年,在JRE1.6中没有任何模式。

    Works on Windows because of this, JRE1.7 has added 'Y' pattern for Week year and in JRE1.6 there is no pattern for this.

    这篇关于Ubuntu上的非法模式字符'Y'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆