2012-04-06 8 views
7

Podczas kompilowania mojej aplikacji libgdx w Eclipse Wciąż otrzymuję ten błąd:Sposób nanoTime() jest niezdefiniowane dla systemu typu w 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 

co oznacza, że ​​GWT nie obsługuje .nanoTime(), to jest czy po prostu działa z niewłaściwym JRE? (Sprawdziłem dla projektu i powiedziałem, że to 1,6).

+0

[ 'System.nanoTime()'] (http://docs.oracle.com/javase/7/docs/api/java/lang/System.html# nanoTime()) znajduje się w JDK od wersji 1.5, więc zdecydowanie nie jest tak, że środowisko JRE jest za stare. –

+0

Mam ten sam błąd z String.format. : D – Emerald214

Odpowiedz

10

Brak wsparcia dla nanoTime() w GWT, ponieważ nie ma obsługi w javascript.

Najbliższy analog GWT jest Duration.currentTimeMillis()

+2

Dodajmy także link do dokumentów: https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation –

Powiązane problemy