java - JDK7 中的 currency.properties 文件

标签 java ubuntu currency

<分区>


想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。

关闭 9 年前

从这里oracle java tutorial :

Suppose that a country adopts a different currency and the ISO 4217 maintenance agency releass a currency update. To implement this update and thereby supercede the default currency at runtime, create a properties file named /lib/currency.properties. This file contains the key/value pairs of the ISO 3166 country code, and the ISO 4217 currency data. The value part consists of three comma-separated ISO 4217 currency values: an alphabetic code, a numeric code, and a minor unit. Any lines beginning with the hash character (#), are treated as comment lines. For example:

Sample currency property for Canada CA=CAD,124,2

但是我不能在我的 usr/lib/jvm/jdk1.7.0/lib 中创建文件 currency.properties,因为我不是所有者。我也尝试过命令 sudo chmod root . 但显然它不会影响它。我正在使用 ubuntu 12.04 并运行 Jdk1.7.0。 是否可以添加该文件或那些 java 文件夹是不可更改的? 提前致谢。

最佳答案

您可以使用应用程序配置目录中的文件。在您的应用开始时运行此代码

String javaHome = System.getProperty("java.home");
System.setProperty("java.home", "conf");
Currency.getInstance("USD");
System.setProperty("java.home", javaHome);

这将使 Currency 从 conf/lib/currency.properties 中读取属性

关于java - JDK7 中的 currency.properties 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16980641/

上一篇:python - Django - importError 在/博客。 (没有名为 urls 的模块)

下一篇:php - 将所有 PHP 请求重定向到 Nginx 重写中的路由器(Tonic Framework)

相关文章:

linux - 如何为命令创建桌面快捷方式

php - Tinyproxy 和 https 请求

java - 以 '0' 结尾的浮点值不能用两位小数表示

sql - 何时在sql server中使用Money数据或Decimal数据类型来存储成本值?

java - 使用 TabHost 和按钮的 Android 1.5 编程

java - Spring ,XMLCOConfiguration : Without indicating annotation in xml file how it is working?

regex - 如何使用 Regex 和 diff 实用程序 ("-I regex"选项忽略特定的文件行)?

ruby-on-rails - 在 Rails 中生成随机固定小数

java - 泛型。使用通配符 `<?>` 与使用类型参数 `<E>`

java - 通过电子邮件发送密码