badramen 2 Posted February 22 (edited) I'm trying to write a script which launches a JavaFX application (instead of Swing - for many reasons). I've coded the JavaFX app (not looking for basic syntax help here...), and it launches standalone perfectly fine. I'm trying to launch it at the beginning of my script so I'm using the below in order to launch it, but nothing is being launched: new Thread(() -> Application.launch(SettingsPanelFX.class)).start(); Before you ask I'm launching it on a separate thread so that the GUI is able to be used while the bot is still being run (to adjust parameters on the fly, partly for debugging purposes but also so that the user never needs to re-launch the script and adjust specific settings such as potion quantities). Anyway, just trying to "get it running" I've called the below in order to get the GUI to launch but it still doesn't work Application.launch(SettingsPanelFX.class); I'm not entirely sure what the issue could be. I suspect that this might have something to do with the way that DreamBot scripts get built? Edited February 22 by badramen jesssterrr 1
Joebi 5 Posted February 22 I had this same issue prior to launching my first script. I would launch one instance fine, though the thread would not terminate properly on script end causing issues when starting back up. Call me crazy, but what’s wrong with swing? There’s lots of nice libraries to make it look good, and good implementations within IntelliJ and other IDEs
fallacy87 8 Posted February 22 14 hours ago, badramen said: I'm trying to write a script which launches a JavaFX application (instead of Swing - for many reasons). I've coded the JavaFX app (not looking for basic syntax help here...), and it launches standalone perfectly fine. I'm trying to launch it at the beginning of my script so I'm using the below in order to launch it, but nothing is being launched: new Thread(() -> Application.launch(SettingsPanelFX.class)).start(); Before you ask I'm launching it on a separate thread so that the GUI is able to be used while the bot is still being run (to adjust parameters on the fly, partly for debugging purposes but also so that the user never needs to re-launch the script and adjust specific settings such as potion quantities). Anyway, just trying to "get it running" I've called the below in order to get the GUI to launch but it still doesn't work Application.launch(SettingsPanelFX.class); I'm not entirely sure what the issue could be. I suspect that this might have something to do with the way that DreamBot scripts get built? It can't load your javaFX class, I don't have an answer exactly how to fix it but I ran into the same problem trying to load an external library into a different API and got the same error.
Pandemic 2816 Posted February 22 It looks like the JVM you're using doesn't include JavaFX (which is why we don't allow JavaFX on the SDN). JavaFX isn't usually included in most Java installations anymore.
badramen 2 Author Posted March 7 Can't we just include JavaFX library as a dependency and package it into the jar
mickert 0 Posted September 18 JavaFX can be a bit tricky to integrate when you're working on something like a DreamBot script, especially if you're new to it. I remember hitting a few roadblocks when I was trying to get everything to work smoothly, and it was frustrating trying to figure it out on my own.
jesssterrr 7 Posted November 4 (edited) I know this post is a bit old, but I thought I'd add some information here regarding this for anyone who is curious... Q: Why do other libraries work at runtime except for JavaFX? Spoiler JavaFX is different from most libraries, which are not as tightly integrated with the Java module system. Why? Because JavaFX was designed to strictly use Java's module system (JPMS) for security and performance reasons. When you compile JavaFX into your JAR file through an IDE like Intellij or maven, it gets placed on the classpath, breaking the module encapsulation required by JavaFX. Basically, it just can’t find its own files anymore. Q: Ok, so then what is the "proper" way to build a JavaFX-supported program? Spoiler The CORRECT way to build JavaFX applications is by using tools like jlink, jpackage, or native-image. However, these build options won't work for us. jlink: this produces a directory that can be executed directly via command-line scripts. No JAR file output. jpackage: It generates .exe, .pkg, or .deb installer files. No JAR file output. native-image: A native binary (like .exe). No JAR file output. Q: Are there any workarounds? Spoiler There is a workaround mentioned in this stackoverflow thread, but it's generally discouraged due to issues like large file size and limited cross-platform compatibility: https://stackoverflow.com/questions/52653836/maven-shade-javafx-runtime-components-are-missing Another option might be to download the libraries at runtime and load them dynamically, but this requires a custom class loader and may still be unreliable. Either way, as Pandemic noted, JavaFX is not allowed as a dependency for scripts on the SDN. TL;DR: JavaFX requires the module path for encapsulation, so shaded JARs on the classpath cause runtime issues—regardless its not allowed on the SDN. Edited November 4 by jesssterrr
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now