title: JavaFX Could not find or load main class
body: <p>I am not using maven, gradle or something like that.</p>
  <p>I can running program on intellij idea but when i build artifacts and i runned the executable jar file from command prompt with <code>java -jar myProgram.jar</code> i  am getting this error:</p>
  <pre><code>Error: Could not find or load main class myProgram.Main
  Caused by: java.lang.ClassNotFoundException: myProgram.Main
  </code></pre>
  <p>But when i try the program from command prompt in src folder with <code>javac -classpath . myProgram/Main.java</code> i am getting this error:</p>
  <pre><code>import javafx.application.Application;
                           ^
  myProgram\Main.java:4: error: package javafx.fxml does not exist
  import javafx.fxml.FXMLLoader;
                    ^
  myProgram\Main.java:5: error: package javafx.scene does not exist
  import javafx.scene.Parent;
                     ^
  myProgram\Main.java:6: error: package javafx.scene does not exist
  import javafx.scene.Scene;
                     ^
  myProgram\Main.java:7: error: package javafx.stage does not exist
  import javafx.stage.Stage;
                     ^
  myProgram\Main.java:8: error: package javafx.stage does not exist
  import javafx.stage.StageStyle;
                     ^
  myProgram\Main.java:13: error: cannot find symbol
  public class Main extends Application {
                            ^
    symbol: class Application
  myProgram\Main.java:20: error: cannot find symbol
      public void start(Stage primaryStage) throws Exception {
                        ^
    symbol:   class Stage
    location: class Main
  myProgram\Main.java:27: error: cannot find symbol
      public static void setWindowForMainPage(Stage stage, URL page) throws IOException {
                                              ^
    symbol:   class Stage
    location: class Main
  myProgram\Main.java:34: error: cannot find symbol
      public static void setWindowForLoginPage(Stage stage, URL page) throws IOException {
                                               ^
    symbol:   class Stage
    location: class Main
  myProgram\Main.java:19: error: method does not override or implement a method from a supertype
      @Override
      ^
  myProgram\Main.java:21: error: cannot find symbol
          loginPage = getClass().getResource(&quot;pages/loginPage.fxml&quot;);
                      ^
    symbol:   method getClass()
    location: class Main
  myProgram\Main.java:22: error: cannot find symbol
          mainPage = getClass().getResource(&quot;pages/mainPage.fxml&quot;);
                     ^
    symbol:   method getClass()
    location: class Main
  myProgram\Main.java:28: error: cannot find symbol
          Parent mainPage = FXMLLoader.load(page);
          ^
    symbol:   class Parent
    location: class Main
  myProgram\Main.java:28: error: cannot find symbol
          Parent mainPage = FXMLLoader.load(page);
                            ^
    symbol:   variable FXMLLoader
    location: class Main
  myProgram\Main.java:29: error: cannot find symbol
          stage.setScene(new Scene(mainPage, 1093, 730));
                             ^
    symbol:   class Scene
    location: class Main
  myProgram\Main.java:35: error: cannot find symbol
          Parent loginPage = FXMLLoader.load(page);
          ^
    symbol:   class Parent
    location: class Main
  myProgram\Main.java:35: error: cannot find symbol
          Parent loginPage = FXMLLoader.load(page);
                             ^
    symbol:   variable FXMLLoader
    location: class Main
  myProgram\Main.java:36: error: cannot find symbol
          stage.setScene(new Scene(loginPage, 400, 170));
                             ^
    symbol:   class Scene
    location: class Main
  myProgram\Main.java:38: error: cannot find symbol
          stage.initStyle(StageStyle.TRANSPARENT);
                          ^
    symbol:   variable StageStyle
    location: class Main
  myProgram\Main.java:44: error: cannot find symbol
          launch(args);
          ^
    symbol:   method launch(String[])
    location: class Main
  21 errors
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Xzv8Y.png" rel="nofollow noreferrer">my file tree</a></p>
  <p>In normally, i am using JDK 16 &amp; JavaFX 16. I can run my other builded jars. But only this project gives this error. And i also tried it with JDK 14 &amp; JavaFX 14.</p>
  <p>My vm options:
  <code>--module-path &quot;C:\Program Files\Java\javafx-sdk-14.0.2\lib&quot; --add-modules javafx.fxml,javafx.controls,javafx.base,javafx.web,javafx.media,javafx.graphics  --add-opens javafx.base/com.sun.javafx.runtime=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED --add-opens javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.binding=ALL-UNNAMED --add-opens javafx.base/com.sun.javafx.event=ALL-UNNAMED --add-opens javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED</code></p>
  <p>My libraries:</p>
  <p>font-awesome
  html-unit
  jasper-reports
  java-fx
  jfoenix</p>