user1104028
user1104028

Reputation: 397

Need Help Creating runnable Jar file for a Java FX Application

I am having an issue with trying to create a runnable Jar file for a Java FX Application I built using Eclipse Neon and Java 1.8. When I attempt to generate the Runnable Jar from Eclipse via the Runnable Jar File Specification dialog box, I get the error message: "Could not find main method from given launch configuration."

I am specifying the main class in the "Launch Configuration" pull down menu.

Appreciate any help with this!

Thanks!

Upvotes: 0

Views: 1047

Answers (2)

dave
dave

Reputation: 1

You can fix this by adding a public void main() defined within your application, thusly:

public class myApplication extends Application
{
  public static void main(String[] args)
  {
    launch(args);
  }

  public void start( Stage stage ) throws Exception
  {
    ...
  }
}

Upvotes: 0

secondbreakfast
secondbreakfast

Reputation: 4372

You should have a build.fxbuild file in the root of your project. Right click that an click Build Export FX Application. Your jar will be located in <project>/build/dist

Upvotes: 2

Related Questions