#The import javafx.fxml cannot be resolved

1 messages · Page 1 of 1 (latest)

rotund marten
#

hello! I have this build.gradle file

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java application project to get you started.
 * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
 * User Manual available at https://docs.gradle.org/7.5.1/userguide/building_java_projects.html
 */

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    id 'application'  
    id 'org.openjfx.javafxplugin' version '0.0.13'
}

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

dependencies {
    // Use JUnit Jupiter for testing.
    testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'

    // This dependency is used by the application.
    implementation 'com.google.guava:guava:31.0.1-jre'

    // postgres jdbc driver
    implementation 'org.postgresql:postgresql:42.5.1'
}

application {
    // Define the main class for the application.
    mainClass = 'demo.App'
}

tasks.named('test') {
    // Use JUnit Platform for unit tests.
    useJUnitPlatform()
}

javafx {
    version = "19"
    modules = [ 'javafx.controls', 'javafx.fxml' ]
}

But I'm getting

The import javafx.fxml cannot be resolvedJava(268435846)

when trying to import javafx.fxml. Any ideas?

glad perchBOT
#

<@&987246399047479336> please have a look, thanks.

glad perchBOT
glad perchBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If your code is long, or you have multiple files to share, consider posting it on sites like https://pastebin.com/ and share the link instead, that is easier to browse for helpers.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

gaunt dove
#

is the version correct?

#

surely it's longer than just "19"

rotund marten
#

Well javafx is working

#

Fxml is not

gaunt dove
#

is it specific to just 19?

#

or doesnt work on older versions as well

polar current
#

that looks correct to me

open shale
#

JavaFX kind of requires you to set up your module-info.java file correctly. Could you post your current one?

#

Otherwise you won't be able to access these packages, even though you made them available on your classpath 🙂

ionic bane
#

what you need are the dependencies and launching the app with javafx:run plugin

open shale
ionic bane
#

you probably didn't run with javafx:run, if you run with the default launch config, it won't work

open shale
ionic bane
ionic bane
#

Also think about splitting Main to application, otherwise it may cause weird problems