title: JavaFX integration with Spring rest client
body: <p>i have implemented Java Spring Rest client application, each rest am geting input xml file , and taxking that file according file values am select jsp file showing in Javafx Webview, once ur transaction completed i need to close that webview window. send back result  as rest clinet response. for every request i need to open javafx webview winodow and process it.</p>
  
  <p>but here am faceing onec issues.</p>
  
  <p>Rest cleint Call</p>
  
  <pre><code>static String url ="http://localhost:8080/login.jsp?value=47&amp;key=645";
      javafx.application.Application.launch(Webview.class);
  </code></pre>
  
  <p>Webview class</p>
  
  <pre><code>public class Webview extends Application {
  
      public static Stage stage;
      public static WebView view;
  
      @Override
      public void start(Stage _stage) throws Exception {
          System.out.println("Start");
          stage = _stage;
          Platform.setImplicitExit(true);
          StackPane root = new StackPane();
  
          view = new WebView();
  
          WebEngine engine = view.getEngine();
          engine.load(PaymentServerRestAPI.BROWSER_URL);
          root.getChildren().add(view);
          engine.setJavaScriptEnabled(true);
          Scene scene = new Scene(root, 800, 600);
          stage.setScene(scene);
  
  
  
          stage.setOnCloseRequest(new EventHandler&lt;WindowEvent&gt;() {
  
              @Override
              public void handle(WindowEvent arg0) {
  
                  Platform.exit();
              }
          });
  
          JSObject window = (JSObject) engine.executeScript("window");
          window.setMember("app", new BrowserApp());
  
          stage.show();
  
      }
  
  }
  </code></pre>
  
  <p>//JavaScript interface object</p>
  
  <pre><code>public class BrowserApp {
  
  
  
      public void exit() {
          System.out.println("exist calling button");
          Browser.frame.setVisible(false);
      }
  }
  </code></pre>
  
  <p>problem is one request successful completed next request am getting 
   "ERROR IN MAIN:java.lang.IllegalStateException: Application launch must not be called more
   than once".
  how to handle this. any other way to handle this problem ,thanks </p>