Giter Club home page Giter Club logo

samples's Introduction

OpenJFX Docs Samples

Description

This repository contains a collection of HelloFX samples. Each one is a very simple HelloWorld sample created with JavaFX that can be run with different options and build tools.

The related documentation for each sample can be found here.

For more information go to https://openjfx.io.

Content

HelloFX samples

Contains samples of a simple HelloFX class that can be run from command line, with or without build tools.

Build Tool Sample Description
None HelloFX project Simple HelloFX class to run on command line.
Maven HelloFX project Simple HelloFX class to run with Maven.
Gradle HelloFX project Simple HelloFX class to run with Gradle.

Command Line

Contains samples of modular and non-modular projects that can be run from command line, with or without build tools.

Modular samples

Build Tool Sample Description
None HelloFX project Modular project to run on command line.
Maven HelloFX project Modular project to run with Maven.
Gradle HelloFX project Modular project to run with Gradle.

Non-modular samples

Build Tool Sample Description
None HelloFX project Non-modular project to run on command line.
Maven HelloFX project Non-modular project to run with Maven.
Gradle HelloFX project Non-modular project to run with Gradle.

IDEs

Contains samples of modular and non-modular projects that can be run from an IDE, with or without build tools.

IntelliJ

Modular samples

Build Tool Sample Description
Java HelloFX project Modular project to run from IntelliJ.
Maven HelloFX project Modular project to run from IntelliJ, with Maven.
Gradle HelloFX project modular project to run from IntelliJ, with Gradle.

Non-modular samples

Build Tool Sample Description
Java HelloFX project Non-modular project to run from IntelliJ.
Maven HelloFX project Non-modular project to run from IntelliJ, with Maven.
Gradle HelloFX project Non-modular project to run from IntelliJ, with Gradle.

NetBeans

Modular samples

Build Tool Sample Description
Java HelloFX project Modular project to run from NetBeans.
Maven HelloFX project Modular project to run from NetBeans, with Maven.
Gradle HelloFX project Modular project to run from NetBeans, with Gradle.

Non-modular samples

Build Tool Sample Description
Java HelloFX project Non-modular project to run from NetBeans.
Maven HelloFX project Non-modular project to run from NetBeans, with Maven.
Gradle HelloFX project Non-modular project to run from NetBeans, with Gradle.

Eclipse

Modular samples

Build Tool Sample Description
Java HelloFX project Modular project to run from Eclipse.
Maven HelloFX project Modular project to run from Eclipse, with Maven.
Gradle HelloFX project Modular project to run from Eclipse, with Gradle.

Non-modular samples

Build Tool Sample Description
Java HelloFX project Non-modular project to run from Eclipse.
Maven HelloFX project Non-modular project to run from Eclipse, with Maven.
Gradle HelloFX project Non-modular project to run from Eclipse, with Gradle.

Visual Studio Code

Modular samples

Build Tool Sample Description
Maven HelloFX project Modular project to run from Visual Studio Code, with Maven.
Gradle HelloFX project Modular project to run from Visual Studio Code, with Gradle.

Non-modular samples

Build Tool Sample Description
Java HelloFX project Non-modular project to run from Visual Studio Code.
Maven HelloFX project Non-modular project to run from Visual Studio Code, with Maven.
Gradle HelloFX project Non-modular project to run from Visual Studio Code, with Gradle.

License

This project is licensed under BSD 3-Clause.

Contributing

This project welcomes all types of contributions and suggestions. We encourage you to report issues, create suggestions and submit pull requests.

Contributions can be submitted via pull requests, providing you have signed the Gluon Individual Contributor License Agreement (CLA).

Please go through the list of issues to make sure that you are not duplicating an issue.

samples's People

Contributors

abhinayagarwal avatar ahndmal avatar jdneo avatar jperedadnr avatar naoghuman avatar tiainen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samples's Issues

Can't launch the non modular IntelliJ Maven Sample

Title is pretty self explanatory, I've downloaded the non modular Maven sample and changed nothing except the javafx version in the pom.xml which I set to 19 instead of 16.
When I try to run it through javafx:run I get this

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------< org.openjfx:hellofx >-------------------------
[INFO] Building hellofx 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> javafx-maven-plugin:0.0.6:run (default-cli) > process-classes @ hellofx >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hellofx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ hellofx ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< javafx-maven-plugin:0.0.6:run (default-cli) < process-classes @ hellofx <<<
[INFO] 
[INFO] 
[INFO] --- javafx-maven-plugin:0.0.6:run (default-cli) @ hellofx ---
[INFO] Toolchain in javafx-maven-plugin null
[ERROR] Command execution failed.
java.io.IOException: Cannot run program "java" (in directory "/home/johan/Desktop/hellofx"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1143)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    at java.lang.Runtime.exec (Runtime.java:615)
    at org.apache.commons.exec.launcher.Java13CommandLauncher.exec (Java13CommandLauncher.java:61)
    at org.apache.commons.exec.DefaultExecutor.launch (DefaultExecutor.java:279)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:336)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:567)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:434)
    at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:105)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:577)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessImpl.forkAndExec (Native Method)
    at java.lang.ProcessImpl.<init> (ProcessImpl.java:315)
    at java.lang.ProcessImpl.start (ProcessImpl.java:245)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1110)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    at java.lang.Runtime.exec (Runtime.java:615)
    at org.apache.commons.exec.launcher.Java13CommandLauncher.exec (Java13CommandLauncher.java:61)
    at org.apache.commons.exec.DefaultExecutor.launch (DefaultExecutor.java:279)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:336)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:567)
    at org.openjfx.JavaFXBaseMojo.executeCommandLine (JavaFXBaseMojo.java:434)
    at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:105)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:577)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.691 s
[INFO] Finished at: 2022-12-07T08:56:47+01:00
[INFO] ------------------------------------------------------------------------```

Cannot access class com.sun.javafx.util.Utils (in module javafx.graphics)

How to solve this problem
jdk 12
javafx D:\javafx-sdk-11.0.2\lib
vmoptions Already set

I'm really tired of reporting this error all the time
ๅฐฑๆ˜ฏ intej ๆ–ฐๅปบ็š„javafx ไพ‹ๅญ

This is the new JavaFX example created by intej

China's technology website CSDN, no one answered, had to turn to foreign technology gurus

Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.IllegalAccessError: class com.sun.javafx.fxml.FXMLLoaderHelper (in unnamed module @0xa51a44a) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0xa51a44a
at com.sun.javafx.fxml.FXMLLoaderHelper.(FXMLLoaderHelper.java:38)
at javafx.fxml.FXMLLoader.(FXMLLoader.java:2056)
at sample.Main.start(Main.java:13)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 1 more
Exception running application sample.Main

Eclipse with the library jars not working

Its very disheartening when you download the hellofx example app, extract it into a project directory, and load all the external jars as module path include in the IDE in an user library then Eclipse compiles and removes all the errors etc, but run button does not work.

Error: Could not find or load main class MyClass
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

edit: eclipse has a runtime setting of which modules on the module list to load, and its by default nothing, needs to be changed manually to MODULE-PATH.

edit: next error is hellofx.fxml loading error even if it has correct path.
edit: solution: fx:controller= variable needs correct class name.

why Java application requires fxml to run?

making a runnable jar from eclipse with including library jars in package is not working also when running with oracle java-21 jvm in java-17 compatibility mode.

additionally the instructions for modular eclipse ide getting hellofx running or app image do not work, both not finding either hellofx module or the jmod required files.

error when running with java -jar myapplication.jar from command line on windows 11 (same code works from eclipse run button):


Feb 17, 2024 1:32:25 AM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @971b07'
Graphics Device initialization failed for : d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:283)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:253)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:263)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:95)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
... 1 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:62)
Caused by: java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:275)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:1583)


Sample won't run because "components are missing"?

I'm pretty sure I'm just missing a piece of code or something somewhere but every time I try to run the program I get this error

Javafx error

I copied the code from the samples. This is what I have.
The Controller File
hellofx_controller

FXML file
hellofx_fxml

Main file
Hellofx_main

I feel like the issue might be with the fxml. Don't know how to fix though.

Gradle task 'Debug' fails in Netbeans 9.0 for hellofx

When running the 'Debug' task in Netbeans 9.0 with config

  • Apache NetBeans IDE 9.0 (Build incubator-netbeans-release-334-on-20180708)
  • Groovy Plugin 1.35
  • Gradle Plugin 2.0.1
  • Gradle 4.10.2

I get the following error:

> Task :debug
Listening for transport dt_socket at address: 5005
Error: JavaFX runtime components are missing, and are required to run this application

So it seems the following section in build.gradle doesn't also work for 'Debug'?

run {
    doFirst {
        jvmArgs = [
                '--module-path', classpath.asPath,
                '--add-modules', 'javafx.controls'
        ]
    }
}

Can't compile HelloFX.java

Windows 10, OpenJDK 17.0.2, JavaFX 17.0.2,

Java directory:
D:\Program Files\Java\jdk-17.0.2\

JavaFX directory:
D:\Program Files\Java\jdk-17.0.2\javafx\

Set environment variable PATH:
PATH=D:\Program Files\Java\jdk-17.0.2\bin\

Set environment variable JAVA_HOME:
JAVA_HOME=D:\Program Files\Java\jdk-17.0.2\

Set environment variable PATH_TO_FX:
PATH_TO_FX=โ€œD:\Program Files\Java\jdk-17.0.2\javafx\libโ€

Test compilation:
samples-master\HelloFX\CLI\hellofx\HelloFX.java

javac --module-path %PATH_TO_FX% --add-modules javafx.controls HelloFX.java

Error message:
error: no source files

I confirm that HelloFX.java exists in the current directory. How come the error message says โ€œno source filesโ€?

Gradle: samples do not run if OpenJFX is not installed on the system

The samples use the gradle application plugin, and so it should be possible to run by typing ./gradlew run in the directory containing the project (i.e. hellofx). While compilation succeeds, running fails. The build.gradle should be changed to add Openjfx dependencies to the run configuration.

Example output:

axel@xiaolong hellofx % ./gradlew build

BUILD SUCCESSFUL in 1s
5 actionable tasks: 5 executed
axel@xiaolong hellofx % ./gradlew run  

> Task :run FAILED
Loading library prism_es2 from resource failed: java.lang.UnsatisfiedLinkError: /Users/axel/.openjfx/cache/13/libprism_es2.dylib: dlopen(/Users/axel/.openjfx/cache/13/libprism_es2.dylib, 1): no suitable image found.  Did find:
        /Users/axel/.openjfx/cache/13/libprism_es2.dylib: code signature in (/Users/axel/.openjfx/cache/13/libprism_es2.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
java.lang.UnsatisfiedLinkError: /Users/axel/.openjfx/cache/13/libprism_es2.dylib: dlopen(/Users/axel/.openjfx/cache/13/libprism_es2.dylib, 1): no suitable image found.  Did find:
        /Users/axel/.openjfx/cache/13/libprism_es2.dylib: code signature in (/Users/axel/.openjfx/cache/13/libprism_es2.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
        at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
        at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
        at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
        at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
        at java.base/java.lang.Runtime.load0(Runtime.java:765)
        at java.base/java.lang.System.load(System.java:1866)
        at javafx.graphics/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:214)
        at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:194)
        at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:135)
        at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
        at javafx.graphics/com.sun.prism.es2.ES2Pipeline.lambda$static$0(ES2Pipeline.java:68)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:310)
        at javafx.graphics/com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:50)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:332)
        at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
        at java.base/java.lang.Thread.run(Thread.java:835)
Loading library prism_sw from resource failed: java.lang.UnsatisfiedLinkError: /Users/axel/.openjfx/cache/13/libprism_sw.dylib: dlopen(/Users/axel/.openjfx/cache/13/libprism_sw.dylib, 1): no suitable image found.  Did find:
        /Users/axel/.openjfx/cache/13/libprism_sw.dylib: code signature in (/Users/axel/.openjfx/cache/13/libprism_sw.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
java.lang.UnsatisfiedLinkError: /Users/axel/.openjfx/cache/13/libprism_sw.dylib: dlopen(/Users/axel/.openjfx/cache/13/libprism_sw.dylib, 1): no suitable image found.  Did find:
        /Users/axel/.openjfx/cache/13/libprism_sw.dylib: code signature in (/Users/axel/.openjfx/cache/13/libprism_sw.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
        at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
        at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
        at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
        at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2617)
        at java.base/java.lang.Runtime.load0(Runtime.java:765)
        at java.base/java.lang.System.load(System.java:1866)
        at javafx.graphics/com.sun.glass.utils.NativeLibLoader.installLibraryFromResource(NativeLibLoader.java:214)
        at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryFromResource(NativeLibLoader.java:194)
        at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:135)
        at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:53)
        at javafx.graphics/com.sun.prism.sw.SWPipeline.lambda$static$0(SWPipeline.java:42)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:310)
        at javafx.graphics/com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:41)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:332)
        at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:218)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
        at java.base/java.lang.Thread.run(Thread.java:835)
Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:244)
        at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
        at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
        at java.base/java.lang.Thread.run(Thread.java:835)
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: No toolkit found
        at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:272)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:158)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:658)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:409)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
        ... 5 more

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/Library/Java/JavaVirtualMachines/adoptopenjdk-12.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* 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
3 actionable tasks: 2 executed, 1 up-to-date

Modular from Eclipse IDE -> Graphics Device initialization failed...

I followed the instructions as in https://openjfx.io/openjfx-docs/#IDE-Eclipse and the example runs fine from within Eclipse with ...javafx-sdk-14.0.1\lib beeing set as module path. Creating a custom runtime image using jlink --module-path "%PATH_TO_FX_MODS%;bin\hellofx" --add-modules=hellofx --output jre produces the jre folder but failes to copy the javafx' dll files (at least prism_d3d.dll, glass.dll and javafx_font.dll) into the \bin subfolder. Without the dll's a

Graphics Device initialization failed for : d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found

message is thrown. What could I be doing wrong?

Error: jlink requires a module descriptor

I tried to follow the example:
https://github.com/openjfx/samples/tree/master/CommandLine/Modular/Maven

it says:

To create and run a custom JRE:

cd CommandLine/Modular/Maven/hellofx
mvn clean javafx:jlink

This is the result:

$ mvn clean javafx:jlink
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------< org.openjfx:hellofx >-------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hellofx ---
[INFO] Deleting $USER/git/openjfx-samples/HelloFX/Maven/hellofx/target
[INFO] 
[INFO] --- javafx-maven-plugin:0.0.3:jlink (default-cli) @ hellofx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory $USER/git/openjfx-samples/HelloFX/Maven/hellofx/src/main/resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to $USER/git/openjfx-samples/HelloFX/Maven/hellofx/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.038 s
[INFO] Finished at: 2020-04-17T13:55:50+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.3:jlink (default-cli) on project hellofx: Error: jlink requires a module descriptor -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Using

Maven

$ mvn -version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.6, vendor: Eclipse OpenJ9, runtime: $USER/.jabba/jdk/[email protected]
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-21-generic", arch: "amd64", family: "unix"

Java

$ java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.18.1, JRE 11 Linux amd64-64-Bit Compressed References 20200122_441 (JIT enabled, AOT enabled)
OpenJ9   - 51a5857d2
OMR      - 7a1b0239a
JCL      - da35e0c380 based on jdk-11.0.6+10)

Tried the modular Java sample in Netbeans but canot run or debug it

I opened the project from samples-master\IDE\NetBeans\Modular\Java\ in Netbeans 11.1 with OpenJDK 13 and OpenJFX 13 on Windows 10.
I can compile it and actually run it using the generated batch file HelloFX\dist\jlink\HelloFX\bin\HelloFX.bat but I cannot launch it from Netbeans itself. When I click on the run or debug buttons, nothing happens...

Missing license either in github project nor in sample files.

Missing license either in github project nor in sourcefiles.

  • No license in the github project openjfx/samples.
  • No license in files from the projects hosted here.

I see the openjfx/javafx-gradle-plugin is licensed under BSD 3-Clause License.
If the license is known, I'm glad to help to refactore all sample files.

Unable to import java.sql.* on modular version

In modular version, I am unable to import java.sql.* , I just see red line on my IDE and when I compile, I get error. java.sql is not in visibile to helloFX . In non-modular build, I can import java.sql.* . Please help me

css has .button instead of .label

The file
samples/IDE/IntelliJ/Modular/Java/hellofx/hellofx/src/org/openjfx/styles.css
has css for .button but the fxml has a Label.

IntelliJ + modular + Gradle does not load resources when running from IntelliJ

Hello,

The example for Intellij + modular + Gradle does not start when invoked directly from IntelliJ. It does not find the fxml file here:

    Parent root = FXMLLoader.load(getClass().getResource("scene.fxml"));

and throws a NPE.

Is there a way to fix this with the Gradle setup? Starting the application with gradlew run works, but then I don't have a debugger support and it is not straightforward.
I think the problem is that the resource files are build to a different output directory (build/classes and build/resources), but IntelliJ does not merge the directories.

I've imported the project into IntelliJ on Windows 7, set JDK 12 as the Gradle and the Project SDK, but did not do any other changes.

Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found - Error on NetBeans 12.6

Hi,

I am a beginner at JavaFX. I want to display a stage but, although I follow the instructed steps to get the exact path (except for storing it in a C: folder which I can't to do since I have Mac), I cannot display it as it shows me: Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found. I saw a previous issue on the same error on NetBeans which said that I have to add the FX library in Modulepath under Run (Properties -> Libraries -> Run -> Modulepath) and, from what I understood delete the part of the path which says: --module-path, I still have no success in displaying the stage. When I follow the latter suggestion I get this error: `Error: Could not find or load main class Documents\FX17\lib'

I also made sure that I unchecked the "compile on save" option. I would highly appreciate other suggestions or corrections to my comprehension of the topic.

Screen Shot 2022-01-24 at 12 00 08 AM

Screen Shot 2022-01-23 at 11 59 43 PM

Facilitated care of links (pictures) in readme for the future.

Facilitated care of links (pictures) in readme for the future.

Based on the experience of my own GitHub projects, I believe that it is easier to update "links" and "images" into "ReadMe"s (written in markdown) when they are bundled at the end of the document.

Proguard support

Hey, can we have a proguard support added for this? I'm currently struggling to add proguard to the project.

NetBeans ignores module path in VM Options

I followed the instructions on how to set up a JavaFX project in NetBeans (Non-modular from IDE) https://openjfx.io/openjfx-docs/#IDE-NetBeans, but running the program did not work.

I added a global library, and added the JavaFX jar files as described in the guide. I then created a new project and added the global library to the compile classpath, and set the VM Options to the module path on my system --module-path /usr/share/openjfx/lib/ --add-modules javafx.controls.

When running the program I got the error message java.lang.module.FindException: Module javafx.controls not found. It seems that NetBeans ignores the option --module-path in Project Settings / Run / VM Options. Instead, I added the JavaFX global library under Project Options / Libraries / Run / Modulepath, and only the option --add-modules javafx.controls to VM Options. Doing so makes the program compile and run just fine.

I tried it both on Linux and Windows, and got the same error message and same solution. NetBeans 11.2, JDK 13, several different versions of openjfx.

When compiling and running the hello world JavaFX project from the command line with javac and java directly, --module-path works just fine, so it does not seem to be a problem with my installation.

Maybe you want to update the instructions in the guide.

Sample Gradle project doesn't build a working application

I'm just trying to get a simple application up and running from an actual build. I thought the project here might provide a working example, but it turns out that it builds a non-working distribution.

Reproduction:

> git clone https://github.com/openjfx/samples
> cd samples\HelloFX\Gradle\hellofx
> set JAVA_HOME="c:\Program Files\Java\jdk-11.0.3"
> gradlew distZip
> cd build\distributions
> unzip hellofx.zip
> cd hellofx\bin
> hellofx.bat

Result:

Error: JavaFX runtime components are missing, and are required to run this application

Am I doing something wrong? I was under the impression that the JavaFX jars fetched via Gradle would be the components it's supposed to be using.

Fat Multi Platform Jar Example not working in all Cases

The OpenJFX Docs link to this sample project to configure maven to build a fat jar. Uncommenting the graphics dependencies will definitely create a multi-platform jar in the package phase, but the same pom cannot be used to do a mvn javafx:run, because then it fails with:

Graphics Device initialization failed for :  es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found

This can be easily circumvented by including the dependencies only when wanting to build the fat jar.
I'll provide a PR with improvements.

Also it would be nice to fix https://openjfx.io/openjfx-docs/ >> Runtime Images >> Non Modular project/application >> Cross-platform jar.

Maven exemple throw error

when running the command mvn clean javafx:run

mvn clean javafx:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.openjfx:hellofx >-------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hellofx ---
[INFO]
[INFO] --- javafx-maven-plugin:0.0.3:run (default-cli) @ hellofx ---
[WARNING] Error injecting: org.openjfx.JavaFXRunMojo
java.lang.TypeNotPresentException: Type org.openjfx.JavaFXRunMojo not present
at org.eclipse.sisu.space.URLClassSpace.loadClass (URLClassSpace.java:147)
at org.eclipse.sisu.space.NamedClass.load (NamedClass.java:46)
at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57)
at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:66)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127)
at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66)
at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:61)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050)
at org.eclipse.sisu.inject.Guice4$1.get (Guice4.java:162)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:520)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:124)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.UnsupportedClassVersionError: org/openjfx/JavaFXRunMojo has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1 (Native Method)
at java.lang.ClassLoader.defineClass (ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass (URLClassLoader.java:468)
at java.net.URLClassLoader.access$100 (URLClassLoader.java:74)
at java.net.URLClassLoader$1.run (URLClassLoader.java:369)
at java.net.URLClassLoader$1.run (URLClassLoader.java:363)
at java.security.AccessController.doPrivileged (Native Method)
at java.net.URLClassLoader.findClass (URLClassLoader.java:362)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf (ClassRealm.java:425)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass (SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass (ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:239)
at org.eclipse.sisu.space.URLClassSpace.loadClass (URLClassSpace.java:139)
at org.eclipse.sisu.space.NamedClass.load (NamedClass.java:46)
at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57)
at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:66)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127)
at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66)
at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:61)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050)
at org.eclipse.sisu.inject.Guice4$1.get (Guice4.java:162)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:520)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:124)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.835 s
[INFO] Finished at: 2020-11-12T09:35:28+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.3:run (default-cli) on project hellofx: Execution default-cli of goal org.openjfx:javafx-maven-plugin:0.0.3:run failed: Unable to load the mojo 'run' in the plugin 'org.openjfx:javafx-maven-plugin:0.0.3' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/openjfx/JavaFXRunMojo has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.openjfx:javafx-maven-plugin:0.0.3
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/Alexandre/.m2/repository/org/openjfx/javafx-maven-plugin/0.0.3/javafx-maven-plugin-0.0.3.jar
[ERROR] urls[1] = file:/C:/Users/Alexandre/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[2] = file:/C:/Users/Alexandre/.m2/repository/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
[ERROR] urls[3] = file:/C:/Users/Alexandre/.m2/repository/org/codehaus/plexus/plexus-java/0.9.11/plexus-java-0.9.11.jar
[ERROR] urls[4] = file:/C:/Users/Alexandre/.m2/repository/org/ow2/asm/asm/7.0-beta/asm-7.0-beta.jar
[ERROR] urls[5] = file:/C:/Users/Alexandre/.m2/repository/com/thoughtworks/qdox/qdox/2.0-M9/qdox-2.0-M9.jar
[ERROR] urls[6] = file:/C:/Users/Alexandre/.m2/repository/org/codehaus/plexus/plexus-archiver/3.6.0/plexus-archiver-3.6.0.jar
[ERROR] urls[7] = file:/C:/Users/Alexandre/.m2/repository/org/codehaus/plexus/plexus-io/3.0.1/plexus-io-3.0.1.jar
[ERROR] urls[8] = file:/C:/Users/Alexandre/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar
[ERROR] urls[9] = file:/C:/Users/Alexandre/.m2/repository/org/apache/commons/commons-compress/1.16.1/commons-compress-1.16.1.jar
[ERROR] urls[10] = file:/C:/Users/Alexandre/.m2/repository/org/objenesis/objenesis/2.6/objenesis-2.6.jar
[ERROR] urls[11] = file:/C:/Users/Alexandre/.m2/repository/org/iq80/snappy/snappy/0.4/snappy-0.4.jar
[ERROR] urls[12] = file:/C:/Users/Alexandre/.m2/repository/org/tukaani/xz/1.8/xz-1.8.jar
[ERROR] urls[13] = file:/C:/Users/Alexandre/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar
[ERROR] urls[14] = file:/C:/Users/Alexandre/.m2/repository/org/twdata/maven/mojo-executor/2.3.0/mojo-executor-2.3.0.jar
[ERROR] urls[15] = file:/C:/Users/Alexandre/.m2/repository/org/slf4j/slf4j-simple/1.7.22/slf4j-simple-1.7.22.jar
[ERROR] urls[16] = file:/C:/Users/Alexandre/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.25/plexus-interpolation-1.25.jar
[ERROR] urls[17] = file:/C:/Users/Alexandre/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[18] = file:/C:/Users/Alexandre/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[19] = file:/C:/Users/Alexandre/.m2/repository/org/apache/maven/maven-builder-support/3.6.0/maven-builder-support-3.6.0.jar
[ERROR] urls[20] = file:/C:/Users/Alexandre/.m2/repository/org/apache/maven/resolver/maven-resolver-util/1.3.1/maven-resolver-util-1.3.1.jar
[ERROR] urls[21] = file:/C:/Users/Alexandre/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.2.1/maven-shared-utils-3.2.1.jar
[ERROR] urls[22] = file:/C:/Users/Alexandre/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar
[ERROR] urls[23] = file:/C:/Users/Alexandre/.m2/repository/com/google/inject/guice/4.2.1/guice-4.2.1-no_aop.jar
[ERROR] urls[24] = file:/C:/Users/Alexandre/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[25] = file:/C:/Users/Alexandre/.m2/repository/com/google/guava/guava/25.1-android/guava-25.1-android.jar
[ERROR] urls[26] = file:/C:/Users/Alexandre/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar
[ERROR] urls[27] = file:/C:/Users/Alexandre/.m2/repository/org/checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar
[ERROR] urls[28] = file:/C:/Users/Alexandre/.m2/repository/com/google/errorprone/error_prone_annotations/2.1.3/error_prone_annotations-2.1.3.jar
[ERROR] urls[29] = file:/C:/Users/Alexandre/.m2/repository/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar
[ERROR] urls[30] = file:/C:/Users/Alexandre/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar
[ERROR] urls[31] = file:/C:/Users/Alexandre/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar
[ERROR] urls[32] = file:/C:/Users/Alexandre/.m2/repository/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
PS C:\Users\Alexandre\Downloads\samples-master\samples-master\HelloFX\Maven\hellofx>

build fails after adding more modules to build.gradle

After adding a module to build.gradle:
javafx {
version = "12"
modules = [ 'javafx.controls' ]
modules = [ 'javafx.media' ]
}
"./gradlew build" produces an error "package javafx.scene.control does not exist"

OS: centos 64, java 12.0.1

FMXLoader Caused Error During run the project

I compile project with Maven compiler:compile, after that i want to run project with javafx:run. Then error comes up: Caused by: java.lang.IllegalStateException: Location is not set.
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)

I do not know why but project didn't see the ".fxml" files.

cli example is missing the jmods folder.

I downloaded the most recent openjfx files and tried to use this example and I get an error about not finding the jmods for javafx. The recent sdk does not include any jmod files and I need to include --module-path $FX_SDK:$FX_JMODS to build/run the program.

Sample app scaling doesn't match OS scaling settings

This might go beyond the goal of these samples but, while I'm able to run them, I'm noticing that the scaling of the javaFX app doesn't match the OS:

image
Notice how the text in the Label' is smaller than the window title or the code in the background (IntelliJ)

This is running on Ubuntu 18.04 with 200% scale (Settings -> Devices -> Displays), JDK 11 downloaded from here and jmods downloaded from here. I wonder if this is an issue with my set up, or there's a missing flag/setting in the sample code that needs to be added.

Update samples

to take into account Gradle 6.4+ for JDK 14+ and the recently published JavaFX gradle plugin 0.0.9

Failed to execute goal

I'll move a project from SWT to JavaFX and start exploring JavaFX and OpenJDK version 12.

I end up with the Getting started with JavaFX and IntelliJ and the Modular with Maven section. I downloaded the project from here and followed the instructions.

On mac I have to modify line 42 (IDE/IntelliJ/Modular/Maven/hellofx/pom.xml)

from

<mainClass>hellofx/org.openjfx.App</mainClass>

to

<mainClass>org.openjfx.App</mainClass>

and everything works fine.

Outdated!

These docs are so outdated. I followed all of the samples, and nothing worked.

The ReadMe isn't good readable.

The ReadMe isn't good readable.

  • Momentary the ReadMe is a endless list of all samples.
  • I find it's difficult to read and look if I want read about a special sample (e.g. NetBeans/Modular/Java).

Suggestion for the new structure:

  1. Section Description.
  2. Section Content contains a list from quick links (pointed to 3.) to all examples.
  3. Section with all samples (e.g. tables for the 3 types of samples (java, maven, gradle)).
  4. Section License.
  5. Section Contribution.

Netbeans JavaFX Modular does not work

Hi.

I have tried the examples for Netbeans:

The documentation for; Non-Modular from IDE is wrog, it misses to include in Project properties->Libraries->Run->ModulePath: JavaFX (from Libraries)

The examples for Non Modular fails the three (ant, maven, gradle)...

blank pop-up window "Hello, JavaFX 17.0.1, running on Java 19.0.1" + WARNING: Timeout while waiting for app reactivation

As for https://openjfx.io/openjfx-docs/#maven,
after running on macOS Sonoma,

mvn javafx:run

confront

com.sun.glass.ui.mac.MacApplication lambda$waitForReactivation$6
WARNING: Timeout while waiting for app reactivation

and blank pop-up window

Hello, JavaFX 20.0.2, running on Java 20.0.2

image

Seems relevant to https://stackoverflow.com/questions/77223963/javafx-window-takes-a-while-to-load-and-getting-an-error-in-eclipse. However, when I try to follow javafx-sdk-20.0.2
https://bugs.openjdk.org/browse/JDK-8315657

<javafx.version>20.0.2</javafx.version>

instead of

<javafx.version>17.0.1</javafx.version>

The issue persists with

Hello, JavaFX 20.0.2, running on Java 20.0.2

image

The original issue exists MacOS Monterey as well.
blank pop-up window

Hello, JavaFX 20.0.2, running on Java 20.0.2

but without

-- com.sun.glass.ui.mac.MacApplication lambda$waitForReactivation$6
-- WARNING: Timeout while waiting for app reactivation

Explain why hellofx.Launcher-class is necessary

There is currently no explanation why the extra class hellofx.Launcher is necessary to launch non-modular JavaFX programs. Why is it not possible to use hellofx.HelloFX directly as main-class, why does that produce the error Error: JavaFX runtime components are missing, and are required to run this application ?

Because this isnt' properly documented, I spent a lot of time trying to figure out why I couldn't port my existing JavaFX-program..

I don't know where else to open this...

Error: Could not find or load main class HelloFX
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

Apparently the openjfx 11.0.2 sdk doesn't include the Application class.

Non Modular JavaFX 12

When i use maven and i do "mvn clean install" i can't run the jar file with "java -jar .jar"

Java version

openjdk version "12.0.2" 2019-07-16 OpenJDK Runtime Environment (build 12.0.2+10) OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

command: "java -jar .jar"
error: "no main manifest attribute, in .jar"

when doing that using this plugin in maven
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.1.2</version> <configuration> <archive> <manifest> <mainClass>nl.joshaprior.App</mainClass> </manifest> </archive> </configuration> </plugin>
it gives me this error "Error: Could not find or load main class nl.joshaprior.App
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application"

when i google that issue and follow all the things i still get the same error

and when using a Start class that calls App.launch() (because i red somewhere that its because of that extends) it gives me this error

        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at nl.joshaprior.Start.main(Start.java:7)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 10 more```

IllegalStateException running NetBeans Modular Maven project

The NetBeans Modular Maven sample project fails to run and prints the exception shown below:

$ mvn clean javafx:jlink
...
[INFO] BUILD SUCCESS
...
$ target/hellofx/bin/launcher 
Exception in Application start method
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
	at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.IllegalStateException: Location is not set.
	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)
	at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
	at [email protected]/org.openjfx.hellofx.App.loadFXML(App.java:32)
	at [email protected]/org.openjfx.hellofx.App.start(App.java:20)
	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
	... 1 more
Exception running application org.openjfx.hellofx.App

The same error occurs when the application is launched from the IDE or with the command mvn clean javafx:run. I'm running under the following environment:

#!/bin/bash
# Sets up the environment for building JavaFX applications
syspath=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# JavaFX Linux SDK and JMODs
export JAVAFX_SDK=$HOME/lib/javafx-sdk-13/lib
export JAVAFX_JMODS=$HOME/lib/javafx-jmods-13

export JAVA_HOME=$HOME/opt/jdk-13.0.1
export ANT_HOME=$HOME/opt/apache-ant-1.10.7
export GRADLE_HOME=$HOME/opt/gradle-6.0-rc-1
export PATH=$GRADLE_HOME/bin:$ANT_HOME/bin:$JAVA_HOME/bin:$syspath

I will follow up shortly with a pull request that fixes the problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.