<分区>
从这里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/
相关文章:
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 中生成随机固定小数