Using JavaFX with packages generates a "JavaFX application class is missing" error

I am working on getting started with JavaFX now that it comes with Java 8 and I have a strange problem. When launched from the default package, my simple Hello World application works fine. However, when pasted into a package, trying to run the program gives me the following error:

Missing JavaFX application class view/JFXHelloWorld

I have included the regular HelloWorld.javafile in the folder viewand it works great.

To clarify, my file structure is as follows:

jfx ----src --------view ------------HelloWorld.java ------------JFXHelloWorld.java ----target --------view ------------HelloWorld.class ------------JFXHelloWorld.class

Where the target is the folder in which I put the compiled files using the following command:

javac -d target src/view/*.java

Running the normal HelloWorld.java file works fine:

java -cp target view/HelloWorld Hello, World!

However, running a JavaFX file causes a problem with ClassLoader:

java -cp target view/JFXHelloWorld Missing JavaFX application class view/JFXHelloWorld

Googling 9 , JavaFX ClassLoader.

HelloWorld.java JFXHelloWorld.java package view; - ? .

+4
2

HelloWorld.

:

java -cp target view.HelloWorld
java -cp target view.JFXHelloWorld

- view/HelloWorld, .

+5

, , JFXHelloWorld , . Java8 Java?

0

Source: https://habr.com/ru/post/1536291/


All Articles