繁体   English   中英

我不知道我为Gluon Start做错了什么

[英]I dont know what i make wrong for the Gluon Start

阿罗哈·盖伊(Aloha Guy),

我没有任何想法,我从胶粘剂开始就犯错了。

  1. 我有intellj IDEA 2018.2.4(社区版)内部版本#IC-182.4505.22,建于2018年9月18日JRE:1.8.0_152-release-1248-b8 amd64 JVM:JetBrains sro Windows 10的OpenJDK 64位服务器VM 10.0

  2. 安装Gluon插件版本:2.7.0

  3. File-> new-> Projekt-> gluon->带FXML的桌面多视图Projekt-> java 11-> finish

  4. 在最近的安装程序视图中,安装gradel Gradle 4.10.2作为本地选项

  5. 我使用Java版本“ 11” 2018-09-25

  6. 我下载了javaFx11(openjfx-11_windows-x64_bin-sdk)并将其作为liblib在结构中使用

知道我有这个->

00:41:11: Executing task 'run'...


> Task :compileJava FAILED
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\actions\MenuActions.java:5: error: package javafx.scene.control does not exist
import javafx.scene.control.Alert;
                           ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\actions\MenuActions.java:7: error: package javafx.scene.image does not exist
import javafx.scene.image.Image;
                         ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\actions\MenuActions.java:8: error: package javafx.scene.image does not exist
import javafx.scene.image.ImageView;
                         ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:7: error: package javafx.fxml does not exist
import javafx.fxml.FXML;
                  ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:8: error: package javafx.scene.control does not exist
import javafx.scene.control.Button;
                           ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:9: error: package javafx.scene.control does not exist
import javafx.scene.control.Label;
                           ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:10: error: package javafx.scene.control does not exist
import javafx.scene.control.TextInputDialog;
                           ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:27: error: cannot find symbol
    private Label label;
            ^
  symbol:   class Label
  location: class PrimaryController
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:30: error: cannot find symbol
    private Button button;
            ^
  symbol:   class Button
  location: class PrimaryController
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\SecondaryController.java:6: error: package javafx.fxml does not exist
import javafx.fxml.FXML;
                  ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\SecondaryController.java:7: error: package javafx.scene.control does not exist
import javafx.scene.control.Button;
                           ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\SecondaryController.java:20: error: cannot find symbol
    private Button button;
            ^
  symbol:   class Button
  location: class SecondaryController
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\GluonApplication.java:4: error: package javafx.scene does not exist
import javafx.scene.Scene;
                   ^
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\GluonApplication.java:7: error: cannot access Application
public class GluonApplication extends ParticleApplication {
       ^
  class file for javafx.application.Application not found
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\GluonApplication.java:14: error: cannot find symbol
    public void postInit(Scene scene) {
                         ^
  symbol:   class Scene
  location: class GluonApplication
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:26: error: cannot find symbol
    @FXML
     ^
  symbol:   class FXML
  location: class PrimaryController
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:29: error: cannot find symbol
    @FXML
     ^
  symbol:   class FXML
  location: class PrimaryController
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:32: error: cannot find symbol
    @FXML
     ^
  symbol:   class FXML
  location: class PrimaryController
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\SecondaryController.java:19: error: cannot find symbol
    @FXML
     ^
  symbol:   class FXML
  location: class SecondaryController
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\SecondaryController.java:22: error: cannot find symbol
    @FXML
     ^
  symbol:   class FXML
  location: class SecondaryController
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\actions\MenuActions.java:24: error: cannot find symbol
        Alert alert = new Alert(AlertType.INFORMATION);
        ^
  symbol:   class Alert
  location: class MenuActions
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\actions\MenuActions.java:24: error: cannot find symbol
        Alert alert = new Alert(AlertType.INFORMATION);
                          ^
  symbol:   class Alert
  location: class MenuActions
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\actions\MenuActions.java:24: error: cannot find symbol
        Alert alert = new Alert(AlertType.INFORMATION);
                                ^
  symbol:   variable AlertType
  location: class MenuActions
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\actions\MenuActions.java:27: error: cannot find symbol
        alert.setGraphic(new ImageView(new Image(MenuActions.class.getResource("/icon.png").toExternalForm(), 48, 48, true, true)));
                             ^
  symbol:   class ImageView
  location: class MenuActions
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\actions\MenuActions.java:27: error: cannot find symbol
        alert.setGraphic(new ImageView(new Image(MenuActions.class.getResource("/icon.png").toExternalForm(), 48, 48, true, true)));
                                           ^
  symbol:   class Image
  location: class MenuActions
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:51: error: cannot access StackPane
        app.getParticle().getToolBarActions().add(0, actionSignin);
                         ^
  class file for javafx.scene.layout.StackPane not found
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:55: error: cannot access ObservableList
        app.getParticle().getToolBarActions().remove(actionSignin);
                                           ^
  class file for javafx.collections.ObservableList not found
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:65: error: cannot find symbol
        TextInputDialog input = new TextInputDialog(stateManager.getProperty("UserName").orElse("").toString());
        ^
  symbol:   class TextInputDialog
  location: class PrimaryController
E:\IntellijProjects\GluonDesktop-MultipleViewProjectwithFXML\src\main\java\com\gluonapplication\controllers\PrimaryController.java:65: error: cannot find symbol
        TextInputDialog input = new TextInputDialog(stateManager.getProperty("UserName").orElse("").toString());
                                    ^
  symbol:   class TextInputDialog
  location: class PrimaryController
29 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
1 actionable task: 1 executed
Compilation failed; see the compiler error output for details.
00:41:11: Task execution finished 'run'.

我会错吗?

Gluon插件2.7.0不久前发布,主要用于使用Java 8创建Gluon Desktop或Gluon Mobile应用程序。

如果您现在使用的是Java 11,则在新版本的Gluon插件发布之前,您将必须更新build.gradle文件。

我建议您在本指南中了解如何开始使用JavaFX 11,并检查有关将IntelliJ添加到项目中的JavaFX 11的问题

当您使用Gluon插件时,您将创建一个Gradle项目。 为此,您无需下载整个JavaFX SDK,您可以通过Maven Central的依赖项将其包括在内。

因此,编辑您的build.gradle文件,如下所示:

apply plugin: 'java'
apply plugin: 'application'

repositories {
    jcenter()
    maven {
        url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
    }
}

mainClassName = 'com.gluonapplication.GluonDesktop'

dependencies {
    compile 'com.gluonhq:particle:1.1.3'
}

并添加以下更改:

  1. 根据Gradle的指南,添加一种方法来查找哪个平台:

     apply plugin: 'java' apply plugin: 'application' def currentOS = org.gradle.internal.os.OperatingSystem.current() def platform if (currentOS.isWindows()) { platform = 'win' } else if (currentOS.isLinux()) { platform = 'linux' } else if (currentOS.isMacOsX()) { platform = 'mac' } repositories { jcenter() maven { url 'http://nexus.gluonhq.com/nexus/content/repositories/releases' } } mainClassName = 'com.gluonapplication.GluonDesktop' 
  2. 为您的平台添加JavaFX依赖项:

     dependencies { compile "org.openjfx:javafx-base:11:${platform}" compile "org.openjfx:javafx-graphics:11:${platform}" compile "org.openjfx:javafx-controls:11:${platform}" compile "org.openjfx:javafx-fxml:11:${platform}" 
  3. 添加与Java 9+兼容的ControlsFX依赖关系(默认情况下使用的是针对Java 8的8.40.14),并添加javax.annotation依赖关系,该依赖关系不属于Java 9+:

      compile 'com.gluonhq:particle:1.1.3' compile 'org.controlsfx:controlsfx:9.0.0' compile 'javax.annotation:javax.annotation-api:1.3.1' } 
  4. 根据指南,您需要添加module-path并将所需的模块添加到编译器参数中:

     compileJava { doFirst { options.compilerArgs = [ '--module-path', classpath.asPath, '--add-modules', 'javafx.controls,javafx.fxml' ] } } 
  5. 与运行参数相同。 在这种情况下,可以通过--add-exports完成对私有API的访问(由于ControlsFX的某些要求):

     run { doFirst { jvmArgs = [ '--module-path', classpath.asPath, '--add-modules', 'javafx.controls,javafx.fxml', '--add-exports', 'javafx.base/com.sun.javafx.runtime=ALL-UNNAMED', '--add-exports', 'javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED', '--add-exports', 'javafx.graphics/com.sun.javafx.scene.traversal=ALL-UNNAMED', ] } } 

保存并同步更改,您应该能够运行Gluon Desktop项目。

Gluon桌面

暂无
暂无

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

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