• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

package javafx.fxml does not exist

 
Greenhorn
Posts: 23
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have reinstalled IntelliJ IDEA with Java SDK 13

but message appears Error:(3, 19) java: package javafx.fxml does not exist

???

What should I do? Install this? https://gluonhq.com/products/javafx/
 
Saloon Keeper
Posts: 10875
235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to install an implementation of Java FX. I don't know about Gluon, I always use OpenJFX, but it probably doesn't matter much.
 
Jim Jupiter
Greenhorn
Posts: 23
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you - it works - I have downloaded Gluon JavaFX  13 SDK from the above mentioned link - then press F4 - open modul settings and then - add lib
 
Jim Jupiter
Greenhorn
Posts: 23
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm

some error occurred

Caused by: java.lang.IllegalAccessError: class com.sun.javafx.fxml.FXMLLoaderHelper (in unnamed module @0x6a15cd04) 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 @0x6a15cd04


Parent root = FXMLLoader.load(getClass().getResource("Main.fxml"));
 
Sheriff
Posts: 6456
172
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you running your project?  From an IDE?  Which one?  Is the project modular or not?
 
Stephan van Hulst
Saloon Keeper
Posts: 10875
235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you put the fxml dependency on the classpath. You need to put it on the modulepath.
 
Jim Jupiter
Greenhorn
Posts: 23
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


as stackoverflow says i have put this to vm options (last two)

Edit: if I delete two lines - same error

IDE  IntelliJ IDEA

modular??? don't know
 
Knute Snortum
Sheriff
Posts: 6456
172
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I bet you haven't added the JavaFX library to the project.  Here are instructions on how to do that.
 
Stephan van Hulst
Saloon Keeper
Posts: 10875
235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a module-info.java file in your project? If so, please show it to us.
 
Jim Jupiter
Greenhorn
Posts: 23
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


same error again

modul-info.java don't see it

I reinstalled IDEA and then Import the project - maybe there some fault?
 
Stephan van Hulst
Saloon Keeper
Posts: 10875
235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please show us your complete project directory structure, and copy and paste the output from your Run Tool Window when you run the application.
 
Jim Jupiter
Greenhorn
Posts: 23
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




 
Stephan van Hulst
Saloon Keeper
Posts: 10875
235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show the output after having added the --module-path and --add-modules switches to your VM options?
 
Jim Jupiter
Greenhorn
Posts: 23
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Now IntelliJ did not start

If you already have a 64-bit JDK installed - define a java home variable

Failed to create JVM path. Path C: program files\java\jdk 13.0.1

appears



Edit:

JAVA_HOME C:\Program Files\Java\jdk-13.0.1
IDEA_JDK_64 C:\Program Files\Java\jdk-13.0.1

I:\javafx-sdk-13.0.1
 
Knute Snortum
Sheriff
Posts: 6456
172
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see anywhere on the command line where you set your module path, e.g.

"C:\Program Files\Java\jdk-13.0.1\bin\java.exe" --module-path /path/to/java/javafx-sdk-11.0.2/lib --add-modules javafx.base,javafx.graphics...
 
Stephan van Hulst
Saloon Keeper
Posts: 10875
235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute, -p is a shorthand for the module path.

It seems that IntelliJ just doesn't deal well with mixed classpath/module projects.

You might want to make your project into a full blown module by adding a module-info.java to the root package and declare that your project requires javafx.controls, javafx.fxml and javafx.graphics.

You might also have to open your module to some JavaFX modules, but your compiler will tell you which ones.
 
Knute Snortum
Sheriff
Posts: 6456
172
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Knute, -p is a shorthand for the module path.



Thanks for clearing that up.

I still don't think the vm args are set correctly.  I tried (in Eclipse) to only use the base and graphics modules and I got a runtime error executing the code.  I think you need the controls module, like this:
Or even more simply:
 
Stephan van Hulst
Saloon Keeper
Posts: 10875
235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For an FXML application you also need to add the javafx.fxml module to the root nodes of the module graph. It just appears that IntelliJ either doesn't understand what modules to add to the graph, or the OP didn't add the module like they said they did.
 
Jim Jupiter
Greenhorn
Posts: 23
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it work with Eclipse or Netbeans? Any know-how?

Try it now this way - didn't understand it - but maybe it works

 
Jim Jupiter
Greenhorn
Posts: 23
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope        

I have installed Eclipse 2019-09

installed e(fx)clipse 3.6.0

Now I'm here



all fx commands are red x

and enough trouble for today ... just relaxing  

Edit: Now it looks like this



Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method launch(String[]) is undefined for the type Main

at DBFX2020.Main.main(Main.java:25)
 
Stephan van Hulst
Saloon Keeper
Posts: 10875
235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're missing a dependency on javafx.graphics.

Honestly, you can save yourself a lot of pain if you just use Maven. All you need to do is declare a dependency on javafx.controls and javafx.fxml and you're good to go. To run the application, use the javafx:run Maven goal.
 
Knute Snortum
Sheriff
Posts: 6456
172
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have an import for Application.
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
create a simple IDEA theme and earn!
https://plugins.jetbrains.com/contest/intellij-themes/2019
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!