1

So, I made JavaFX project and it works perfectly in IDE (checked by Eclipse and IntelliJIDEA), but exported runnable jar doesn't work (checked by Eclipse and IntelliJIDEA). I cannot suppose, where is problem, because I checked export and running this JAR on 2 computers.

@SuppressWarnings("unchecked")
@Override
public void start(Stage primaryStage) {
    try {
        FXMLLoader loader = new FXMLLoader();
        loader.setLocation(Main.class.getResource("view.fxml"));
        layout = (AnchorPane) loader.load();
        Scene scene = new Scene(layout);
        primaryStage.setScene(scene);
        primaryStage.show();
        ff = (ImageView) scene.lookup("#FirstFrame");
        ff.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                if(pointCount < 4){
                    System.out.println(pointCount);
                    Point toAdd = new Point((int)event.getX(),(int)event.getY());
                    points.add(toAdd);
                    System.out.println(toAdd);
                    pointCount++;
                }
            }
       });
        @SuppressWarnings("rawtypes")
        ChoiceBox cb = (ChoiceBox) scene.lookup("#TrackerChooser");
        cb.setItems(FXCollections.observableArrayList(trackerList));
        cb.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>(){
            public void changed(@SuppressWarnings("rawtypes") ObservableValue ov, Number value, Number newValue){
                chosenTracker = trackerList[newValue.intValue()];
            }
        });
        Button start = (Button) scene.lookup("#Start");
        Button fileChooser = (Button) scene.lookup("#FileChooser");
        Button clear = (Button) scene.lookup("#Clear");
        ButtonController.clearListener(clear, this);
        ButtonController.startListener(start, this);
        ButtonController.fileChooserListener(fileChooser, scene, this);
    } catch(Exception e) {
        e.printStackTrace();
    }
}

public String getChosenTracker(){
    return chosenTracker;
}

public void setVideo(File v){
    video = v;
}

public void setPath(){
    path = video.getAbsolutePath();
}

public void setPreview() throws org.bytedeco.javacv.FrameGrabber.Exception{
    FFmpegFrameGrabber g = new FFmpegFrameGrabber(new File(path));
    g.start();
    Java2DFrameConverter jfc = new Java2DFrameConverter();
    Image im = SwingFXUtils.toFXImage(jfc.convert(g.grab()), null);
    ff.setImage(im);
    g.stop();
    System.out.println(im.getHeight() + " " + im.getWidth());
    System.out.println(ff.getFitHeight() + " " + ff.getFitWidth());
    System.out.println(ff.getY() + " " + ff.getX());
}

public static void main(String[] args) {
    launch(args);
}
Diaglyonok
  • 11
  • 2
  • What happens when you try to run the jar? – Jason Schindler May 19 '17 at 17:52
  • Can you open it, so it shows for example the Main Stage/Window but though the program is not working? – Yahya May 19 '17 at 17:56
  • Nothing, but there is process in dispetcher with no CP or hdd load. However, it eats some RAM memory. – Diaglyonok May 19 '17 at 18:02
  • There is no any windows opened, when I run jar – Diaglyonok May 19 '17 at 18:03
  • Run the [jar file from the command line](http://stackoverflow.com/questions/1238145/how-to-run-a-jar-file). Edit your question to provide any stack trace output. Consider supplying an [mcve]. Ensure that a relevant version of JavaFX is installed on the target machines. Check that any library jars required are supplied with the jar file. Run `jar tvf` on your jar file and check that everything you expect is in the jar file in the locations you expect them to be (and include the output in your question). – jewelsea May 19 '17 at 18:15

0 Answers0