I tried a google example on this page:
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideJavaFromJavaScript
I want to be able to call a Java method from JSNI, but nothing happens. There are no errors, but methods are not called. However, I can change the fields from my class.
Here is the code I tried:
package com.jsni.client;
import com.google.gwt.core.client.EntryPoint;
public class Testjsnii implements EntryPoint {
String myInstanceField;
static int myStaticField;
void instanceFoo(String s) {
System.out.println(s);
}
static void staticFoo(String s) {
System.out.println(s);
}
public native void bar(Testjsnii x, String s) ;
public void onModuleLoad() {
bar(this,"Hello");
}
}
It does not print anything on the console, but only waring, which says:
[WARN] [testjsnii] - JSNI method '@ com.jsni.client.Testjsnii :: bar (Lcom / jsni / client / Testjsnii; Ljava / lang / String;)' returns> JavaScript object type value (1), but it was void declared it should not return value> at all
I wonder what the problem is.
Thanks for the help.