#first time using javaFX with maven

1 messages · Page 1 of 1 (latest)

rocky fox
#

So im trying to work towards making a basic calculator using javaFX with maven, and was reading a peice of documentation of oracle about the basic hello world application. I copy and pasted it into my main file and tried to run it but im getting an error

package ronapps;
 
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
 
public class Calculator extends Application {
    
    @Override
    public void start(Stage primaryStage) {
        Button btn = new Button();
        btn.setText("Say 'Hello World'");
        btn.setOnAction(new EventHandler<ActionEvent>() {
 
            @Override
            public void handle(ActionEvent event) {
                System.out.println("Hello World!");
            }
        });
        
        StackPane root = new StackPane();
        root.getChildren().add(btn);

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

        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }
 public static void main(String[] args) {
        launch(args);
    }
}```

Website i was reading: https://docs.oracle.com/javase/8/javafx/get-started-tutorial/hello_world.htm
tulip hamletBOT
#

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

pseudo spade
#

What error?

rocky fox
#

its the image

#

LinkageError occured while loading main class ronapps.Calculator

jagged magnet
#
  • send pom
  • run java -version
rocky fox
#

ok

#

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>ronapps</groupId>
    <artifactId>calculator</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>23.0.1</version>
        </dependency>
    </dependencies>

</project>```
rocky fox
#

Ok

#

nope i treied it and it didnt work

#

on new error

#

the old one is gone

#

but i got this one:

severe stump
rocky fox
#

how do i update the java runtime to recognise class file versions that are 67.0

severe stump
#
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
rocky fox
#

is there a way for me to check which java runtime components are missing?

rocky fox
#

also, im using vscode

#

does vscode not support v23?

severe stump
#

I recommend using IntelliJ CE.

#

VSCode does, but VSCode also needs some more setup.

tulip hamletBOT
rocky fox
#

i already have intellij but i jsut prefer vscode

jagged magnet
#

but java doesnt

pseudo spade
#

IntelliJ is the GOAT

tulip hamletBOT
#

@rocky fox

Your question has been closed due to inactivity.

If it was not resolved yet, feel free to just post a message below
to reopen it, or create a new thread.

Note that usually the reason for nobody calling back is that your
question may have been not well asked and hence no one felt confident
enough answering.

When you reopen the thread, try to use your time to improve the quality
of the question by elaborating, providing details, context, all relevant code
snippets, any errors you are getting, concrete examples and perhaps also some
screenshots. Share your attempt, explain the expected results and compare
them to the current results.

Also try to make the information easily accessible by sharing code
or assignment descriptions directly on Discord, not behind a link or
PDF-file; provide some guidance for long code snippets and ensure
the code is well formatted and has syntax highlighting. Kindly read through
https://stackoverflow.com/help/how-to-ask for more.

With enough info, someone knows the answer for sure 👍

rocky fox
# pseudo spade IntelliJ is the GOAT

yeah i switched from vscode to intellij im gonna be so real here the only reason i was using vscode over intellij is becuase the text editor was nicer to look at and it had better themes 🙃

pseudo spade
severe stump
#

It does.