我在运行时不断收到此错误,我不知道是什么导致它。它认为有文件缺失?
Caused by: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.7.0_07\lib\currency.data
什么是currency.data
,任何人都可以建议为什么会这样,我的JDK现在已经不是那么久了,因为我们现在已经7点17分了。
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文件夹中?
答案 0 :(得分: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);
答案 1 :(得分:3)
我遇到了同样的问题。它是由Java verison冲突引起的(&#34; JAVA_HOME&#34;设置为1.7,属性&#34; -Djava.home&#34;设置为1.6)。
我正在使用mvn来构建项目,并在环境变量MAVEN_OPTS中使用选项&#34; java-home&#34;设置为错误值:
MAVEN_OPTS = -Xmx512m -XX:MaxPermSize=256m "-Djava.home=C:\Program Files\Java\jdk1.6.0_35\jre"
只需正确即可:
MAVEN_OPTS = -Xmx512m -XX:MaxPermSize=256m
还要检查您的其他环境变量:
MAVEN_OPTS
JAVA_HOME
答案 2 :(得分:3)
这是我的决定。 您可以在代码中添加:
System.setProperty("java.home", "C:\\Program Files\\Java\\jdk1.8.0_60\\jre");
您必须替换您的jdk版本的路径。
答案 3 :(得分:1)
我发现currency.data
位于:
C:\Program Files\Java\jdk1.7.0_17\jre\lib
或
C:\Program Files\Java\jdk1.7.0_07\lib
出于某种原因,当我执行我的程序时,Java不知道更深入地看一个目录。
答案 4 :(得分:0)
在旧的skool时代,Sun指定JAVA_HOME应该指向JDK_HOME / jre,如果安装了JDK而不是JRE。
这种差异已逐渐被侵蚀,原因与“exalator”正在成为“自动扶梯”的可接受发音相同:无处不在。
无论如何,一些较旧的应用仍然认为JAVA_HOME是JRE的根源
答案 5 :(得分:0)
JDK 1.7.0_43在lib /下没有currency.data,只在jre / lib中。这迫使我改变构建脚本以使用JDK进行编译,然后使用JRE进行单元测试。除非有更好的方法。
答案 6 :(得分:0)
在服务器运行时安装新jre后,我在wildfly 10中部署的webapp遇到了同样的问题。重新启动服务器解决了这个问题。