public static void createCanvas(String appClass) {
    AppSettings settings = new AppSettings(true);
    settings.setWidth(640);
    settings.setHeight(480);

    try {
      Class<? extends Application> clazz = (Class<? extends Application>) Class.forName(appClass);
      app = clazz.newInstance();
    } catch (ClassNotFoundException ex) {
      ex.printStackTrace();
    } catch (InstantiationException ex) {
      ex.printStackTrace();
    } catch (IllegalAccessException ex) {
      ex.printStackTrace();
    }

    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.createCanvas();
    app.startCanvas();

    context = (JmeCanvasContext) app.getContext();
    canvas = context.getCanvas();
    canvas.setSize(settings.getWidth(), settings.getHeight());
  }
 public static void startApp() {
   app.startCanvas();
   app.enqueue(
       new Callable<Void>() {
         public Void call() {
           if (app instanceof SimpleApplication) {
             SimpleApplication simpleApp = (SimpleApplication) app;
             simpleApp.getFlyByCamera().setDragToRotate(true);
           }
           return null;
         }
       });
 }