2017-06-29 3 views
0

Ich habe ein Problem mit der Analyse meines Datums. Ich habe das Datum „Mittwoch, 28. 06. 2017“ als String und mit dem folgenden Code, um es für die Analyse:Nicht übertragbares Datum, aber mit dem richtigen Gebietsschema - Java

date = new SimpleDateFormat("EEEE, dd. MM. yyyy", Locale.GERMAN).parse("Mittwoch, 28. 06. 2017"); 

Aber das ist immer noch mir die unparseable Datum Fehler geben.

Wenn ich es auf einem anderen System laufen, funktioniert es gut.

Vielen Dank

EDIT:

java.text.ParseException: Unparseable date: "Mittwoch, 28. 06. 2017" 
     at java.text.DateFormat.parse(DateFormat.java:366) 
     at Download.StartDownload(Download.java:88) 
     at Download.main(Download.java:42) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. 
java:62) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces 
sorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:483) 
     at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa 
der.java:58) 
Exception in thread "main" java.lang.reflect.InvocationTargetException 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. 
java:62) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces 
sorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:483) 
     at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa 
der.java:58) 
Caused by: java.lang.NullPointerException 
     at java.util.Calendar.setTime(Calendar.java:1770) 
     at java.text.SimpleDateFormat.format(SimpleDateFormat.java:943) 
     at java.text.SimpleDateFormat.format(SimpleDateFormat.java:936) 
     at java.text.DateFormat.format(DateFormat.java:345) 
     at Download.StartDownload(Download.java:94) 
     at Download.main(Download.java:42) 
     ... 5 more 

EDIT: Ich habe eine ältere Java-Version verwenden, die den Fehler verursacht hat.

+0

Es sollte Ihnen sagen, warum es das nicht unparse kann. Poste diesen Fehler, damit wir dir helfen können. BEARBEITEN: ** post the stacktrace als Text bitte ** – AxelH

+0

post Fehler msg als auch. – Sanjay

+0

'Ursache von NullPointerException', das ist ein Anfang ... Was ist die Java-Version? – AxelH

Antwort

0

Versuchen mit EEE statt EEEE

date = new SimpleDateFormat("EEE, dd. MM. yyyy", Locale.GERMAN).parse("Mittwoch, 28. 06. 2017") 
+0

Funktioniert leider immer noch nicht. Es ist immer noch der gleiche Fehler. – SO1992

+0

@ SO1992 Ihr Code funktioniert auf Java 1.8.0_66 – Antoniossss

+0

Check diese URL, wenn dies dazu beitragen kann: https: //stackoverflow.com/questions/19861642/date-format-parse-exception-eee-mmm-dd-hhmmss-z- yyyy – Sanjay

Verwandte Themen