-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error trying to import JavaFX classes in Processing 4 #15
Comments
The |
Hey, @micycle1. The javafx library seems to have all the JavaFX modules. In Windows they are located in Of course I could create a library called |
Hm, the problem is that JavaFX now uses modules, rather than the older classpath system. So we have to explicitly define which pieces of the library to include. Unfortunately this isn't a great situation for Processing: we've only committed to JavaFX as a renderer—not doing generic JavaFX programming inside the PDE. All that other stuff isn't part of the Processing API, so we're not importing it. I guess we might be able to just tell it to import “everything.” That's overkill/messy/slow but might be the only way to support these cases. Just need to figure out the simplest/least messy way to handle this. |
Thanks for looking into this, @benfry. And for all the awesome work in Processing of course! 👍 If it was possible to pass a command line parameter to Processing 4 so it would load the extra JavaFX modules, that would be enough for me and possibly for others in the same situation. Maybe a generic parameter to load code that was available in older versions of Processing and is not available anymore? Kinda messy but maybe better than to slow down Processing by always loading this code? In my case I would need this parameter/configuration to be passed along to exported applications as well, if possible. |
Ok, digging into this a bit more… There are two issues:
Also, that being said, the OP code that was posted will not work: import javafx.beans.property.SimpleIntegerProperty;
void setup() {
SimpleIntegerProperty version = new SimpleIntegerProperty(1);
}
void draw() {
background(0);
} …because Import Library → JavaFX has not been used here. Just downloading the library doesn't make it magically work, you need to use Import Library first (or type out the import statement yourself, so that it picks up the library). But that's not the central issue here, because even when “Import Library” is used, this code still won't run. |
Great! I believe once the JAR files in the And sure, I will import the JavaFX library. I posted the code above as an example that worked on Processing 3.x, but I realize the JavaFX code was moved to a library and that I will have to import it. No problem at all. Thanks again |
Added a new issue (processing/processing4#522) in the main repo to cover the first part of what I mention above. |
And in the meantime, this is still possible from other IDEs like IntelliJ or Eclipse, where you have to deal with all this stuff yourself; it's just that the PDE isn't set up to do this automatically. |
The requisite jar files and libraries for javafx live in Documents/Processing/libraries/javafx/library/macos-x86_64/modules on my system, but they do have to be hooked up. See line 1086: https://github.com/processing/processing4/blob/3185ebae15f1ee894a9a2a056cc253b4677012e3/java/src/processing/mode/java/JavaBuild.java |
Description
I have a project based on Processing 3 and I'm trying to make it work with Processing 4. It uses a few JavaFX classes and I just can't get them to work. I know JavaFX was moved to a separate library but even after installing it I get an error trying to import JavaFX classes in Processing 4.
BTW I asked this same question in discourse.processing.org but no one seems to know.
Expected Behavior
JavaFX imports should work once you install the JavaFX library.
Current Behavior
Installing the JavaFX library and trying to import a JavaFX class gives me this error:
The package “javafx” does not exist. You might be missing a library.
Steps to Reproduce
Your Environment
Possible Causes / Solutions
If there's anything I need to do after installing the JavaFX library, please let me know.
The text was updated successfully, but these errors were encountered: