Skip to content
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

Javafx imports reported as not found by IDE - App Compiles and Runs #234467

Open
AlexanderAdelAU opened this issue Nov 23, 2024 · 1 comment
Open
Assignees

Comments

@AlexanderAdelAU
Copy link

This test app compiles and runs, but after 2 days of trying I cannot get rid of the wavy red lines to all references to javafx. The class file does not show any error. Also, Intellisense works and javafx is recognised until you hit enter and then the wavy line appears.

I have included first line of "Problems" along with launch, tasks and settings json files.

For example:
[{
"resource": "/c:/Development-C/VSCode/Workspaces/Java/SimpleWindow/src/Main.java",
"owner": "generated_diagnostic_collection_name#1",
"code": "errors(1): 1:8-1:14",
"severity": 8,
"message": "package javafx.application does not exist",
"startLineNumber": 1,
"startColumn": 8,
"endLineNumber": 1,
"endColumn": 14
},

Source Code:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import javafx.scene.layout.StackPane;

public class Main extends Application {
@OverRide
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World");

    Button btn = new Button("Close");
    btn.setOnAction(e -> primaryStage.close());

    StackPane root = new StackPane();
    root.getChildren().add(btn);

    Scene scene = new Scene(root, 300, 200);

    primaryStage.setScene(scene);
    primaryStage.show();
}

public static void main(String[] args) {
    launch(args);
}

}
Settings.json:
{
"java.home": "C:/Java/64bit/Oracle_JDK-23",
"java.debug.settings.hotCodeReplace": "manual",
"java.configuration.runtimes": [
{
"name": "JavaSE-23",
"path": "C:/Java/64bit/Oracle_JDK-23"
}
],
"java.project.referencedLibraries": [
"c:\Java\64bit\javafx-sdk-23.0.1\lib\javafx.base.jar",
"c:\Java\64bit\javafx-sdk-23.0.1\lib\javafx.controls.jar",
"c:\Java\64bit\javafx-sdk-23.0.1\lib\javafx.fxml.jar",
"c:\Java\64bit\javafx-sdk-23.0.1\lib\javafx.graphics.jar"
]
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Launch JavaFX",
"request": "launch",
"mainClass": "Main",
"vmArgs": "--module-path C:/Java/64bit/javafx-sdk-23.0.1/lib --add-modules javafx.controls,javafx.fxml"
}
],
"args": [
"--module-path", "C:/Java/64bit/javafx-sdk-23.0.1/lib",
"--add-modules", "javafx.controls,javafx.fxml"
]
}
and
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "javac",
"args": [
"--module-path",
"C:/Java/64bit/javafx-sdk-23.0.1/lib",
"--add-modules",
"javafx.controls,javafx.fxml",
"-d",
"bin",
"src/Main.java"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

@AlexanderAdelAU
Copy link
Author

Screen shot.
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants