奇怪的 Java 运行时错误 -currency.data [英] Weird Java runtime error - currency.data

查看:99
本文介绍了奇怪的 Java 运行时错误 -currency.data的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行时不断收到此错误,但我不知道是什么原因造成的.它认为缺少文件?

I keep getting this error during runtime and I have no idea what is causing it. It believes there is a file missing?

Caused by: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.7.0_07\lib\currency.data

什么是 currency.data 谁能建议为什么会发生这种情况,我的 JDK 不是那么旧,因为我们现在在 7u17 中.

What is currency.data and can anyone suggest why this is happening, my JDK isn't that old since we're in 7u17 now.

Exception in thread "AWT-EventQueue-0" java.lang.InternalError
    at java.util.Currency$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.Currency.<clinit>(Unknown Source)
    at java.text.DecimalFormatSymbols.initialize(Unknown Source)
    at java.text.DecimalFormatSymbols.<init>(Unknown Source)
    at java.text.DecimalFormatSymbols.getInstance(Unknown Source)
    at java.text.NumberFormat.getInstance(Unknown Source)
    at java.text.NumberFormat.getNumberInstance(Unknown Source)
    at java.util.Scanner.useLocale(Unknown Source)
    at java.util.Scanner.<init>(Unknown Source)
    at java.util.Scanner.<init>(Unknown Source)
    at ciphor.CiCompile$7.actionPerformed(CiCompile.java:458)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.7.0_07\lib\currency.data (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    ... 48 more

我在 JDK 环境下运行我的程序,我检查了我的 jre7 文件夹,currency.data 存在于那里!为什么它只存在于jre文件夹中?

I'm running my program with the JDK environment, I checked my jre7 folder and currency.data is present there! Why is it only present in the jre folder?

推荐答案

我遇到了类似的错误,这只是为了帮助其他可能陷入同样陷阱的人:)

错误:

java.lang.InternalError: java.io.FileNotFoundException: null/lib/currency.data (No such file or directory)

这是因为我设置了全局属性,结果证明这是一件非常不聪明的事情.

This is because I set the global properties which turns out to be a very un-clever thing to do.

System.setProperties(new Properties());

系统属性填充了非常重要的数据,包括:

The System properties are populated with very important data including:

  • path.separator
  • 用户目录
  • file.encoding
  • file.separator
  • java.io.tmpdir

所以除非你知道自己在做什么,否则基本上不要做上面的事情.

So basically don't do the above unless you know what you are doing.

如果您想要一个属性,请改为这样做:

If you want to a a property, do this instead:

System.getProperties().put("SOME_KEY", "SOME_VALUE");

Map myCustomMapOfProps = ...
System.getProperties().putAll(myCustomMapOfProps);

这篇关于奇怪的 Java 运行时错误 -currency.data的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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