2012-04-06 5 views
7

Während meine Libgdx Anwendung in Eclipse kompilieren ich diesen Fehler erhalte:Verfahren Nanotime() ist nicht definiert für den Typ-System in GWT

[ERROR] Errors in 'file:/C:/Users/Zorfie/Programing/Java/workspace/Libgdx/src/sim/states/BasicBox2DState.java' 
     [ERROR] Line 157: The method nanoTime() is undefined for the type System 
     [ERROR] Line 159: The method nanoTime() is undefined for the type System 
     [ERROR] Line 160: The method nanoTime() is undefined for the type System 
     [ERROR] Line 161: The method nanoTime() is undefined for the type System 
    [ERROR] Errors in 'jar:file:/C:/Program%20Files/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201203300216-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/web/bindery/autobean/shared/impl/StringQuoter.java' 
     [ERROR] Line 21: The import org.json cannot be resolved 
     [ERROR] Line 69: JSONObject cannot be resolved 
    [ERROR] Errors in 'jar:file:/C:/Program%20Files/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201203300216-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/web/bindery/autobean/vm/impl/JsonSplittable.java' 
     [ERROR] Line 23: The import org.json cannot be resolved 
     [ERROR] Line 24: The import org.json cannot be resolved 
     [ERROR] Line 25: The import org.json cannot be resolved 
     [ERROR] Line 40: JSONObject cannot be resolved to a type 
     [ERROR] Line 47: JSONObject cannot be resolved to a type 

was bedeutet, dass GWT nicht .nanoTime unterstützt(), dann ist dies der Fall oder laufe ich einfach mit der falschen JRE? (Ich überprüfte das Projekt und es hieß, es sei 1,6).

+0

[ 'System.nanoTime()'] (http://docs.oracle.com/javase/7/docs/api/java/lang/System.html# nanoTime()) befindet sich seit JDK 1.5 im JDK, es ist also definitiv nicht so, dass Ihre JRE zu alt ist. –

+0

Ich habe den gleichen Fehler mit String.format. : D – Emerald214

Antwort

10

Es gibt keine Unterstützung für nanoTime() in GWT, da es keine Unterstützung in Javascript gibt.

Der nächste analog in GWT ist Duration.currentTimeMillis()

+2

Fügen Sie auch einen Link zur Dokumentation hinzu: https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation –

Verwandte Themen