Hi there!

Can anyone help me with the error mentioned above?

I try to make an interface to JavaScript so I can call a function. My
Java code looks like that:

 public void onModuleLoad() {

        setShowTrigger(this);

  }

  public native void setShowTrigger(Index x)/*-{

  $wnd.showIndex = function () {

  website.client.Index::runApp()();

  };

  }-*/;

  public void runApp() {

          Window.alert("I am a GWT function");
  }

As soon as I add the method "setShowTrigger" it crashes with the
following error. Do I have to include a special library? Or is there
another way to call a GWT function from the HTML part?

[ERROR] file:/C:/gwt_work/Website/src/website/client/Index.java(36,
28): invalid label
com.google.gwt.dev.js.JsParserException: invalid label
        at com.google.gwt.dev.js.JsParser$1.error(JsParser.java:88)
        at com.google.gwt.dev.js.rhino.Context.reportError(Context.java:459)
        at com.google.gwt.dev.js.rhino.TokenStream.reportSyntaxError
(TokenStream.java:1553)
        at com.google.gwt.dev.js.rhino.Parser.reportError(Parser.java:72)
        at com.google.gwt.dev.js.rhino.Parser.statementHelper(Parser.java:
783)
        at com.google.gwt.dev.js.rhino.Parser.statement(Parser.java:360)
        at com.google.gwt.dev.js.rhino.Parser.parseFunctionBody(Parser.java:
156)
        at com.google.gwt.dev.js.rhino.Parser.function(Parser.java:257)
        at com.google.gwt.dev.js.rhino.Parser.primaryExpr(Parser.java:1224)
        at com.google.gwt.dev.js.rhino.Parser.memberExpr(Parser.java:1163)
        at com.google.gwt.dev.js.rhino.Parser.unaryExpr(Parser.java:1079)
        at com.google.gwt.dev.js.rhino.Parser.mulExpr(Parser.java:1031)
        at com.google.gwt.dev.js.rhino.Parser.addExpr(Parser.java:1015)
        at com.google.gwt.dev.js.rhino.Parser.shiftExpr(Parser.java:1003)
        at com.google.gwt.dev.js.rhino.Parser.relExpr(Parser.java:987)
        at com.google.gwt.dev.js.rhino.Parser.eqExpr(Parser.java:976)
        at com.google.gwt.dev.js.rhino.Parser.bitAndExpr(Parser.java:966)
        at com.google.gwt.dev.js.rhino.Parser.bitXorExpr(Parser.java:956)
        at com.google.gwt.dev.js.rhino.Parser.bitOrExpr(Parser.java:946)
        at com.google.gwt.dev.js.rhino.Parser.andExpr(Parser.java:935)
        at com.google.gwt.dev.js.rhino.Parser.orExpr(Parser.java:924)
        at com.google.gwt.dev.js.rhino.Parser.condExpr(Parser.java:908)
        at com.google.gwt.dev.js.rhino.Parser.assignExpr(Parser.java:890)
        at com.google.gwt.dev.js.rhino.Parser.assignExpr(Parser.java:896)
        at com.google.gwt.dev.js.rhino.Parser.expr(Parser.java:880)
        at com.google.gwt.dev.js.rhino.Parser.statementHelper(Parser.java:
775)
        at com.google.gwt.dev.js.rhino.Parser.statement(Parser.java:360)
        at com.google.gwt.dev.js.rhino.Parser.parseFunctionBody(Parser.java:
156)
        at com.google.gwt.dev.js.rhino.Parser.function(Parser.java:257)
        at com.google.gwt.dev.js.rhino.Parser.parse(Parser.java:116)
        at com.google.gwt.dev.js.JsParser.parse(JsParser.java:112)
        at com.google.gwt.dev.javac.JsniCollector.parseAsAnonymousFunction
(JsniCollector.java:271)
        at com.google.gwt.dev.javac.JsniCollector.access$000
(JsniCollector.java:45)
        at com.google.gwt.dev.javac.JsniCollector$JsniMethodImpl.function
(JsniCollector.java:82)
        at com.google.gwt.dev.util.Jsni.getJavaScriptForHostedMode(Jsni.java:
115)
        at com.google.gwt.dev.shell.CompilingClassLoader.injectJsniFor
(CompilingClassLoader.java:662)
        at com.google.gwt.dev.shell.CompilingClassLoader.findClassBytes
(CompilingClassLoader.java:637)
        at com.google.gwt.dev.shell.CompilingClassLoader.findClass
(CompilingClassLoader.java:588)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.google.gwt.dev.shell.ModuleSpace.loadClassFromSourceName
(ModuleSpace.java:516)
        at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:299)
        at com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace
(BrowserWidget.java:329)
        at com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$300
(BrowserWidgetIE6.java:37)
        at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad
(BrowserWidgetIE6.java:76)
        at com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke
(BrowserWidgetIE6.java:139)
        at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke
(IDispatchImpl.java:294)
        at com.google.gwt.dev.shell.ie.IDispatchImpl.method6
(IDispatchImpl.java:194)
        at org.eclipse.swt.internal.ole.win32.COMObject.callback6
(COMObject.java:117)
        at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
        at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
        at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
        at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
        at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to