O
O
Oleg Genevjov2017-07-25 23:24:05
MySQL
Oleg Genevjov, 2017-07-25 23:24:05

How to connect JavaFX to a Maven project?

Hello.
Kills the question, how do I connect JavaFX to a Maven project. All attempts lead to a huge number of exceptions like NullPointer and ClassNotFound and refers to 1 line where an FXML file with markup is imported into the start() method.
Well, I'm really asking for help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Kornachev, 2017-07-26
@Genevjov

Oleg Genevjov : I'll try to be clairvoyant (through space and unwillingness to show at least a piece of code where fxml is loaded)
I'm almost sure that before connecting the link (address in the form of a string) to fxml was
If yes, then after connecting maven, you need to correct the *.fxml address, namely, add a slash to the beginning:

FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/blablabla/Some.fxml"));

V
Vladislav Kutas, 2018-10-29
@ThreeDogNight

You need to add a plugin to Maven

<plugin>
                <groupId>com.zenjava</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>8.8.3</version>
                <configuration>
                    <mainClass>com.kutas.u.Main</mainClass>
                </configuration>
            </plugin>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question