简体   繁体   English

Javafx fxml文件出现错误

[英]Javafx fxml file with errors

I'm opening new JavaFX project in IntelliJ, I have all necessary files of JDK installed, but in fxml file there are multiple errors "Unexpected token". 我正在IntelliJ中打开新的JavaFX项目,已经安装了JDK的所有必需文件,但是在fxml文件中有多个错误“意外令牌”。 This error shows immediately after opening new javafx project and fxml file (meaning there's nothing I add or remove from the basic fxml tags). 打开新的javafx项目和fxml文件后立即显示此错误(这意味着我没有从基本fxml标记中添加或删除任何内容)。 What can I do? 我能做什么?

You have to follow IntelliJ instructions here . 您必须在此处遵循IntelliJ的说明

  1. Download and install JDK 7 or a later version (earlier JDK versions don't include the JavaFX SDK necessary for JavaFX application development). 下载并安装JDK 7或更高版本(早期JDK版本不包括JavaFX应用程序开发所需的JavaFX SDK)。
  2. If you are going to use JavaFX Scene Builder, download and install it as well. 如果要使用JavaFX Scene Builder,请也下载并安装它。
  3. Make sure that the JavaFX plugin is enabled. 确保已启用JavaFX插件。 (JavaFX support in IntelliJ IDEA in based on the JavaFX plugin. This plugin is bundled with the IDE and enabled by default.) See To make sure that the JavaFX plugin is enabled. (基于JavaFX插件的IntelliJ IDEA中的JavaFX支持。此插件与IDE捆绑在一起,并且默认情况下启用。)请参阅确保已启用JavaFX插件。
  4. Define the JDK in IntelliJ IDEA. 在IntelliJ IDEA中定义JDK。 You can do that separately (see To define JDK 7 in IntelliJ IDEA) or when creating a project or module (see Creating a project for JavaFX development). 您可以单独进行操作(请参阅在IntelliJ IDEA中定义JDK 7),也可以在创建项目或模块时进行操作(请参阅为JavaFX开发创建项目)。
  5. If necessary, specify the path to the JavaFX Scene Builder executable file. 如有必要,请指定JavaFX Scene Builder可执行文件的路径。 If you do so, you'll be able to open your FXML files in the Scene Builder right in IntelliJ IDEA. 这样,您就可以在IntelliJ IDEA中的Scene Builder中打开FXML文件。 See To specify the path to the JavaFX Scene Builder executable file. 请参阅指定JavaFX Scene Builder可执行文件的路径。
  6. Create a project for your JavaFX application development. 为您的JavaFX应用程序开发创建一个项目。 Your can create the corresponding project from scratch or, if you already have the source files you want to continue working with, you can create a project by importing the corresponding sources. 您可以从头开始创建相应的项目,或者,如果已经有了要继续使用的源文件,则可以通过导入相应的源来创建项目。 See Creating a project for JavaFX development or Creating a Project by Importing Existing Sources. 请参阅为JavaFX开发创建项目或通过导入现有源代码创建项目。 See also, Using Scene Builder with IntelliJ IDEA. 另请参阅将Scene Builder与IntelliJ IDEA一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM