Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird Java runtime error - 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

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

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?

like image 798
Ciphor Avatar asked Apr 04 '13 22:04

Ciphor


2 Answers

I got a similar error and this is just to help other people who may fall into the same trap :)

Error :

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
  • user.dir
  • 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");

or

Map myCustomMapOfProps = ...
System.getProperties().putAll(myCustomMapOfProps);
like image 116
rjdkolb Avatar answered Sep 20 '22 17:09

rjdkolb


This is my solution. You can add this in your code:

System.setProperty("java.home", "C:\\Program Files\\Java\\jdk1.8.0_60\\jre");

You must substitute the path of yours jdk version.

like image 5
Progressify Avatar answered Sep 17 '22 17:09

Progressify