有时候javafx项目运行正常,但是scenebuilder打开fxml文件时出现如下错误:
Open operation has failed.Make sure that the chosen file is a valid FXML document.

Scenebuilder打开fxml文件报错解决方案

原因分析:
  1. 原因一、该fxml为FXML Editer编辑,fxml中所引入的jar包均存在于项目的buildpath中,但是scenebuilder的Library Manager中未添加该jar包,因此项目可正常运行,但scenebuilder无法打开;
  2. 原因二、该fxml使用scenebuilder编辑,且scenebuilder中Library Manager也添加了必须的jar包,但后期jar包丢失因此无法打开。
解决方法:

举例:如下图fxml文件中引入了两种类型的jar,其中第二种属于javafx sdk中的组件,scenebuilder可以自动识别;但是第一种jar属于第三方插件,scenebuilder不能识别,需要在Library Manager中添加相应的jar包。Scenebuilder打开fxml文件报错解决方案

操作步骤
  • 点击Library的下三角,打开JAR/FXML Manager
Scenebuilder打开fxml文件报错解决方案
  • 选择 Add Library/FXML from file system
Scenebuilder打开fxml文件报错解决方案
  • 将所需Jar包引入
Scenebuilder打开fxml文件报错解决方案


此时便能顺利打开FXML文件了
Scenebuilder打开fxml文件报错解决方案

相关文章:

  • 2021-07-27
  • 2021-11-03
  • 2021-04-12
  • 2021-06-18
猜你喜欢
  • 2022-12-23
  • 2021-09-07
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
相关资源
相似解决方案