• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Why aren't the JavaFX packages being recognized?

 
Ranch Foreman
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Around the end of the first chapter in this textbook I'm using, there's a graphics supplement that uses JavaFX to draw a smiley face. It gives the reader some code to copy: But when I get to compiling it it doesn't detect any of the packages being imported. Now from what I understand by downloading the JavaFX files I can access to these packages, but that doesn't seem to work. My Java version is 21.0.2
 
Marshal
Posts: 80226
424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How old is your textbook? I think JavaFX was introduced about the time of Java8, but since then Oracle hived it off to somebody else, possibly Apache, so it is no longer part of the usual Java® installation.
You would have to add the location of JavaFX to your CLASSPATH. Please tell us where you placed the JavaFX file.
 
Master Rancher
Posts: 5109
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are compiling the code in a command prompt window, can you copy the command line you used that calls the compiler and paste it here?
 
Evan Bonno
Ranch Foreman
Posts: 36
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay so following the instructions from here: https://openjfx.io/openjfx-docs/#install-javafx I was able to get the smiley face to load on to the screen. I didn't come up with the code yet I feel so smart having up on my screen haha. Thank you Norm and Campbell for responding.
 
Bartender
Posts: 322
12
IntelliJ IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You found the link that I was about to send up. That's the best setup resource these days since it was pulled out of the normal JDK. (I wish it could be pulled more out. It still basically just as inaccessible and hard to contribute to as the JDK. I can't use email lists!)

It wasn't hauled off to Apache though - if anyone, it seems to be Gluon that contributes the most to OpenJFX. (Seems like a cool company too - no I'm not affiliated with them or anything.)

I still prefer to not mess around with the "normal" extra steps, and use SDKMAN to install one of Azul's fx-java JDK builds (or Gluon has one too) which has OpenJFX built in. Turns the process into about 2-3 CLI commands and that's it other than pointing your IDE to it. But you kinda need to be using Linux for it to be that easy.
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic