1

I don't have any idee what I make wrong for the beginning with Gluon.

  1. I have IntelliJ IDEA 2018.2.4 (Community Edition)
    Build #IC-182.4505.22, built on September 18, 2018
    JRE: 1.8.0_152-release-1248-b8 amd64
    JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    Windows 10 10.0

  2. install Gluon Plugin Version: 2.7.0

  3. File->new->Project->gluon->Desktop Multi view Project with FXML->java 11->finish

  4. install gradel Gradle 4.10.2 used it as local option in last setup view

  5. I use java version "11" 2018-09-25

  6. I download the javaFx11 (openjfx-11_windows-x64_bin-sdk) and use it in an Structure as a libery

know I have this -->

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'.

Which step did I make a mistake in?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Harry05
  • 37
  • 6

1 Answers1

4

The Gluon plugin 2.7.0 was released a while ago, mainly to create Gluon Desktop or Gluon Mobile applications with Java 8.

If you are using now Java 11, until there is a new release of the Gluon plugin, you will have to update the build.gradle file.

I'd suggest you have a look at how to get started with JavaFX 11 in this guide, and check this question about adding JavaFX 11 to a project in IntelliJ.

When you use the Gluon plugin you are creating a Gradle project. And for that, you don't need to download the whole JavaFX SDK, you can include it via dependencies from Maven Central.

So edit your build.gradle file, that looks like:

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'
}

And add the following changes:

  1. According to the guide for Gradle, add a way to find which is your platform:

    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. Add the JavaFX dependencies for your platform:

    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. Add the ControlsFX dependency compatible with Java 9+ (by default is using 8.40.14 which was for Java 8) and add the javax.annotation dependency, that is not part of 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. According to the guide, you need to add the module-path and add the required modules to the compiler arguments:

    compileJava {
        doFirst {
            options.compilerArgs = [
                    '--module-path', classpath.asPath,
                    '--add-modules', 'javafx.controls,javafx.fxml'
            ]
        }
    }
    
  5. And the same for the run arguments. In this case, the access to private API (due to some requirement of ControlsFX), can be done with --add-exports:

    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',
    
            ]
        }
    }
    

Save and sync the changes and you should be able to run your Gluon Desktop project.

Gluon Desktop

José Pereda
  • 44,311
  • 7
  • 104
  • 132
  • Sorry what shity it that. i thinked that glouon company fix ist from Java 8 to 9 Java reales. That call that i have to use the old Version of Java becous dosn't fix it from Java 8to9 ,8to10,8to11. I meine that gloun Still Standing in the development. The Idee Stop on Java 8. Grrr – Harry05 Oct 07 '18 at 06:57
  • First of all, if you find it "shity", feel free to go and use other technology. If you still like to use it, and want to work with Java 11, you can do the upgrade yourself, as you only have to modify the `build.gradle` file as I proposed here. Most of the JavaFX projects nowadays have to do this migration. And if you have a license, please email to support at gluonhq dot com and ask for a new release of the framework. – José Pereda Oct 07 '18 at 11:51
  • No i Like the Main ldee behind it, but the configuration make my depressive . But I anderstand right all developer use java 8 for it for Desktop and mobile? – Harry05 Oct 08 '18 at 14:04
  • Thanks @JoséPereda. Your suggested fix worked for me. – splonk Feb 05 '20 at 04:34