Missing JavaFX application class

10,203

That is because you are calling your application with a directory path instead of the fully qualified classname. The fully qualified classname is composed from the package name and the class name. In your case this is mypackage.MyApp.

Assuming that your compiled class resides in the same folder as the source .java file, call it this way:

java -cp myjava/src mypackage.MyApp
Share:
10,203
mnrendra
Author by

mnrendra

Updated on June 09, 2022

Comments

  • mnrendra
    mnrendra almost 2 years

    I have java code like this:

    package mypackage;
    
    import javafx.application.Application;
    import javafx.stage.Stage;
    
    public class MyApp extends Application{
        public static void main(String args[]){
            launch(args);
        }
        public void start(Stage primaryStage){
            primaryStage.show();
        }
    }
    

    and I've compiled it at ~/myjava/src/mypackage/MyApp.class . then, when I'm running from

    ~$ java -cp myjava/src mypackage/MyApp
    

    why getting error like:

    Missing JavaFX application class mypackage/MyApp
    

    I'm using JDK 8.