Java 8 DateTimeFormatter issue

Answered

I'm using latest Idea community edition (2016.3.1) and JDK 1.8u111. I've ran into some weird runtime errors. When I compile and run this code in any online IDE it works fine. http://ideone.com/ojxwIQ 

But when I compile and run it in Idea it throws an exception. 


I've tried reinstalling both Idea and JDK, deleting out, rebuilding the project and nothing seems to work.

JDK in project settings is set to 8u111.


This is driving me crazy. Anyone got any ideas about it?

0
3 comments

Why do you think it's IDE problem?

Does it work in the command line with javac/java?

Could it be locale specific?

0

Because any other online IDE compiles and runs that code just fine? Idk.

Maybe it is a locale specific.

0

It is locale specific. Specifying 

private static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MMM/yyyy:HH:mm:ss Z").withLocale(Locale.US);

Does the trick. Sorry for the inconvienience. 

0

Please sign in to leave a comment.