Cip*_*hor 11 java runtime-error
我在运行时不断收到此错误,我不知道是什么导致它.它认为有文件缺失?
Caused by: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.7.0_07\lib\currency.data
什么是currency.data,可以有人建议为什么会发生这种情况,我的JDK并不是那么老,因为我们现在已经7u17了.
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文件夹中?
rjd*_*olb 11
我得到了类似的错误,这只是为了帮助其他可能陷入同一陷阱的人:)
错误:
java.lang.InternalError: java.io.FileNotFoundException: null/lib/currency.data (No such file or directory)
这是因为我设置了全局属性,这是一个非常不聪明的事情.
System.setProperties(new Properties());
系统属性填充了非常重要的数据,包括:
所以除非你知道自己在做什么,否则基本上不要做上述事情.
如果你想要一个房产,请改为:
System.getProperties().put("SOME_KEY", "SOME_VALUE");
要么
Map myCustomMapOfProps = ...
System.getProperties().putAll(myCustomMapOfProps);
这是我的解决方案。您可以在代码中添加:
System.setProperty("java.home", "C:\\Program Files\\Java\\jdk1.8.0_60\\jre");
您必须替换您的 jdk 版本的路径。
我发现currency.data可以在以下任一位置找到:
C:\Program Files\Java\jdk1.7.0_17\jre\lib
或者
C:\Program Files\Java\jdk1.7.0_07\lib
由于某种原因,当我执行程序时,Java 不知道更深层次地查看一个目录。