title: How to properly build native executable file from jar?
body: <p>I have had Intellij IDEA generate an executable jar for me and executing the jar using <code>java -jar</code> command works great.</p>
  
  <p>But when I try to wrap this jar into an exe file using launch4j, various errors happen. First there was an error saying "Could not find or load main class".</p>
  
  <p>After looking at <a href="https://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean">this</a> and <a href="https://stackoverflow.com/questions/42880748/java-class-is-present-in-classpath-but-startup-fails-with-error-could-not-find/42880749#42880749">this</a> questions I thought the problem is about pathnames or classnames. However, that was not the case. Apparently, the main class was found, but couldn't be loaded because there was no pathnames to Java and JavaFX runtimes.</p>
  
  <p>After adding rt.jar and jfxrt.jar to classpaths another error appeared:</p>
  
  <p>"JavaFX runtime components are missing, and are required to run this application"</p>
  
  <p>And now I really don't know what to do. I downloaded the latest jre (8.0.221) but nothing changed. jfxrt.jar is a JavaFX runtime to my knowledge, but it seems like the application doesn't recognize it as one.</p>
  
  <p>Any recommendations for deploying, suggestions for my project or remarks are welcome and appreciated. Thanks!</p>