• Post Reply Bookmark Topic Watch Topic
  • New Topic

DatatypeConverter.parseDate returns java.lang.NullPointerException  RSS feed

 
Adam Muller
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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!
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!