Java 我不知道胶子开始时我做错了什么
阿罗哈·盖伊 我不知道从胶子开始我犯了什么错误Java 我不知道胶子开始时我做错了什么,java,gradle,desktop,gluon,Java,Gradle,Desktop,Gluon,阿罗哈·盖伊 我不知道从胶子开始我犯了什么错误 我有intellj IDEA 2018.2.4(社区版) 建造#IC-182.4505.22,建造于2018年9月18日 JRE:1.8.0_152-release-1248-b8 amd64 JVM:JetBrains s.r.o提供的OpenJDK 64位服务器虚拟机 视窗10.0 安装Gluon插件版本:2.7.0 文件->新建->项目->Glion->桌面多视图项目与FXML->java 11->完成 安装gradel Gradle 4.1
我犯了什么错误?Gluon插件2.7.0不久前发布,主要用于使用Java 8创建Gluon桌面或Gluon移动应用程序 如果您现在使用的是Java 11,在Gluon插件发布之前,您必须更新build.gradle文件 我建议您在本文中了解一下如何开始使用JavaFX11,并检查一下如何将JavaFX11添加到IntelliJ中的项目中 当你使用Gluon插件时,你正在创建一个Gradle项目。为此,您不需要下载整个JavaFXSDK,您可以通过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'
}
并添加以下更改:
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'
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}"
javax.annotation
依赖项:
compile 'com.gluonhq:particle:1.1.3'
compile 'org.controlsfx:controlsfx:9.0.0'
compile 'javax.annotation:javax.annotation-api:1.3.1'
}
compileJava {
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls,javafx.fxml'
]
}
}
--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',
]
}
}
不久前发布了Glon插件2.7.0,主要用于使用Java 8创建Glon桌面或Glon移动应用程序 如果您现在使用的是Java 11,在Gluon插件发布之前,您必须更新build.gradle文件 我建议您在本文中了解一下如何开始使用JavaFX11,并检查一下如何将JavaFX11添加到IntelliJ中的项目中 当你使用Gluon插件时,你正在创建一个Gradle项目。为此,您不需要下载整个JavaFXSDK,您可以通过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'
}
并添加以下更改:
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'
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}"
javax.annotation
依赖项:
compile 'com.gluonhq:particle:1.1.3'
compile 'org.controlsfx:controlsfx:9.0.0'
compile 'javax.annotation:javax.annotation-api:1.3.1'
}
compileJava {
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls,javafx.fxml'
]
}
}
--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',
]
}
}
对不起,真是糟糕透了。我认为glouon公司的修复程序是从Java8到9JavaReales。我必须使用旧版本的Java,因为它不能从Java 8到9、8到10、8到11进行修复。我觉得格隆还在发展中。Idee在Java8上停止。GRRR首先,如果你觉得它“糟糕”,那就去使用其他技术吧。如果您仍然喜欢使用它,并且希望使用Java11,那么您可以自己进行升级,因为您只需要修改
build.gradle
文件,就像我在这里建议的那样。现在大多数JavaFX项目都必须进行这种迁移。如果您有许可证,请发送电子邮件至gluonhq.com的支持部门,并要求发布新版本的框架。不,我喜欢它背后的主ldee,但配置让我沮丧,谢谢@JoséPereda。你的建议对我有用。对不起,那是什么鬼东西。我认为glouon公司的修复程序是从Java8到9JavaReales。我必须使用旧版本的Java,因为它不能从Java 8到9、8到10、8到11进行修复。我觉得格隆还在发展中。Idee在Java8上停止。GRRR首先,如果你觉得它“糟糕”,那就去使用其他技术吧。如果您仍然喜欢使用它,并且希望使用Java11,那么您可以自己进行升级,因为您只需要修改build.gradle
文件,就像我在这里建议的那样。现在大多数JavaFX项目都必须进行这种迁移。如果您有许可证,请发送电子邮件至gluonhq.com的支持部门,并要求发布新版本的框架。不,我喜欢它背后的主ldee,但配置让我沮丧,谢谢@JoséPereda。你建议的解决办法对我有效。