Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users

    Recommended Posts

    Posted (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. 

    image.png.ac6fe1b12dcec99994674c5f247d0ce8.png

    I suspect that this might have something to do with the way that DreamBot scripts get built?

     

    Edited by badramen
    Posted

    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

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

    image.png.ac6fe1b12dcec99994674c5f247d0ce8.png

    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.

    Posted

    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.

    • 2 weeks later...
    Posted

    Can't we just include JavaFX library as a dependency and package it into the jar

    • 6 months later...
    Posted

    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. 

    • 1 month later...
    Posted (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 by jesssterrr

    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.