javafx.controls module can't be found but its exists in the right location
17:26 04 Dec 2025

I using JDK 25 and Apache Netbeans and Windows 11. My javafx sdk folder is in C:\ and I verified that it is indeed in the lib folder. But the compiler still says it can't find it. Im pretty sure I initialized the correct VM options. Oh and my build tool is Ant.

VM Options: --module-path "C:\javafx-sdk-25.0.1\lib" --add-modules=javafx.controls,javafx.fxml

Erorr Message I keep getting: Error occurred during initialization of boot layer

java.lang.module.FindException: Module javafx.fxml

not found

Also can't find javafx.controls ^^^

Question: What am I possibly doing wrong and why can't the compiler find these two files?

I read some stuff regarding dependencies causing this type of error. IF that is the case can someone explain on how I would be able to configure these dependencies properly.

Full Code (if it helps):

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
 */
package robot2;

// Java FX library for playing mp3 audios

import com.phidget22.*;
import javafx.application.Application;
import javafx.scene.Scene;
//import javafx.scene.control.Label;
import javafx.stage.Stage;
import javafx.scene.media.*;
import java.io.FileInputStream;
import static javafx.application.Application.launch;
/**
 *
 * @author #
 */
public class Robot2 extends Application {
    
    private boolean alarmBlaring = false; // debounce boolean. prevents multiple JavaFX threads while one is already active
    
    /**
     * @param args the command line arguments
     */
    
    @Override
    public void start (Stage stage)
    {
        
        if (!alarmBlaring)
        {
            
            alarmBlaring = true;
        
            System.out.println("Alarm playing!");

            String fileDir = "\"C:\\Users\\#\\Downloads\\alarm-clock-90867.mp3\""; // path to the mp3 audio file of the alarm

            Media audioMedia = new Media(fileDir); // gets the file from the directory string
            MediaPlayer alarm = new MediaPlayer(audioMedia); // declares the player of the mp3 file

            alarm.setVolume(0.5);
            alarm.setCycleCount(MediaPlayer.INDEFINITE); // loops the alarm audio indefinitely

            try
            {

                alarm.play();
                Thread.sleep(10000); // stop the alarm audio after 10 seconds
                alarm.stop();
                alarmBlaring = false;

            }
            catch (Exception e)
            {
                alarmBlaring = false;
                System.out.println("error occured: " + e); // print out error message
            }
            
        }
        
    }
    
    public static void main(String[] args) throws Exception{
        // TODO code application logic here
        
        // configs
        float dbThreshold = 20f; // the max difference to trigger the output device (speaker/light)
        
        // inits
        FileInputStream alarmDir = new FileInputStream(".mp3");
        
        SoundSensor dbChecker = new SoundSensor();
        double prevDb = 0;
        
        dbChecker.setHubPort(4);
        //dbChecker.setIsHubPortDevice(true);
        
        //greenLED.open(1000);
        dbChecker.open(5000);
        
        while (true)
        {
            try
            {
                double db = dbChecker.getdB();
                
                if (prevDb == 0)
                {
                    prevDb = db;
                } else
                {
                    
                    System.out.println("db: " + db + " | " + "prev: " + prevDb);
                    
                    double dbDiff = db - prevDb;
                    if (dbDiff > dbThreshold)
                    {
                        
                        launch(args);
                        
                    } 
                    
                }
                
                prevDb = db;
                
                //System.out.println("Recorded Decibles: " + db);
                
                // db spike logic
                
                
            }
            catch (PhidgetException err)
            {
                System.out.println("Decibles exceed sensor capability");
            }
            Thread.sleep(250);
            
        }
        
    }
    
}
java javafx