• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DatatypeConverter.parseDate returns java.lang.NullPointerException

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I have a code like this:

public static void main(String argv[]) {
System.out.println("balanceDate: " + DatatypeConverter.parseDate("2011-01-01"));
}

I can run this code on two machines with no problem (either from Eclipse or from commandline).
On third machine, this code fails with
Exception in thread "main" java.lang.NullPointerException
at javax.xml.bind.DatatypeConverter.parseDate(Unknown Source)
at ReadXMLFile.main(ReadXMLFile.java:19)

This is the java version on the third machine (JRE only):
Z:\>java -version
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)

The other two machines have java 1.6.0_26 JDK.

Q: Do I need JDK to run this code? Why doesn't it work with JRE? Do I need to add some .JARs?

Thanks!
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's possible that this was some bug that was fixed somewhere between Java 1.6.0_02 and Java 1.6.0_26. I suggest you update it anyway.
 
reply
    Bookmark Topic Watch Topic
  • New Topic