3

I have JavaFX code that I know that works, but I'm not sure how to run it in Eclipse.

I installed E(fx)clipse and I know that my java files work.

When I try to run the file though it says editor does not contain a main type.

3
  • I've had this same problem as well; I'm interested to see the solution. Commented Apr 19, 2015 at 17:12
  • I know that it's something to do with JavaFX not being integrated with Eclipse like it is in Netbeans. Commented Apr 19, 2015 at 17:13
  • Not sure if this worked in 2015, but now the answer gives me the same "does not contain a main type error" as when using Application.launch(TheClass.class) in a separate class. If I put just a system out into the main, then it is found (in Eclipse), and it also works flawlessly when started from the terminal. Using Java FX dependencies via Maven. Commented Aug 28, 2019 at 12:02

1 Answer 1

1

I think you need the Eclipse workaround for starting JavaFX applications. Simply add the following to the class which extends javafx.application.Application:

public static void main(String[] args)
{
    launch(args);
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.