passando valores para JavaFX a partir de javascript

Como este é meu primeiro post, perdoe quaisquer imprecisões. Meu problema, quero passar o valor de uma função javascript para Javafx no método initialize

public void initialize(URL arg0, ResourceBundle arg1) {

    // TODO Auto-generated method stub
    final URL urlGoogleMaps = getClass().getResource("googlemaps.html");
    System.out.println("fjdsoij");
    browser.getEngine().load(urlGoogleMaps.toExternalForm());
    WebEngine webEngine = browser.getEngine(); 
    webEngine.getLoadWorker().stateProperty().addListener(
            new ChangeListener<State>(){

                @Override
                public void changed(ObservableValue<? extends State> ov, State oldState, State newState) {
                    if(newState == State.SUCCEEDED){
                        JSObject window = (JSObject)webEngine.executeScript("window");
                        window.setMember("app", new JavaApplication());

                    }
                }
            });
}

public class JavaApplication{
    public void calljavascript( int lengthInMeters){

        System.out.println(lengthInMeters);
    }
}   

}

e a parte javascript é assim

   function initialize() {
  var mapOptions = {
    zoom: 3,
    center: new google.maps.LatLng(0, -180),
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };

  var map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);

  var flightPlanCoordinates = [
    new google.maps.LatLng(37.772323, -122.214897),
    new google.maps.LatLng(21.291982, 157.821856)

  ];
  var flightPath = new google.maps.Polyline({
    path: flightPlanCoordinates,
     //geodesic: true,
    strokeColor: '#FF0000',
    strokeOpacity: 1.0,
    strokeWeight: 2
  });
var lengthInMeters = google.maps.geometry.spherical.computeLength(flightPath.getPath());

  flightPath.setMap(map);
   alert("polyline is "+lengthInMeters+" long");
   app.calljavascript(lengthInMeters);
}

google.maps.event.addDomListener(window, 'load', initialize);

O valor que quero passar é o lengthInMeters no método calljavascript alguma idéia? thnx antecipadamente

questionAnswers(1)

yourAnswerToTheQuestion