I got this error while trying to start and make javafx 2.0 in eclipse helios
Exception in thread "main" java.lang.IllegalArgumentException: expected
if you don't depend on running in helios I'd suggest you'd give e(fx)clipse a try. You can find it at http://www.efxclipse.org/
Well, these answers seem to say what you need to do, but they're not very straight-forward.
Trust me I tried it and it works.
It's easy you need to have a main Class that extends Application Class for Launch the Args like that :
public class Test extends Application {
public static void main(String[] args) {
// Launch the Application
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
//JavaFx load the GUI from FXML file ... super
Parent root = FXMLLoader.load(getClass().getResource("yourGUI.fxml"));
primaryStage.setTitle("App Name");
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
}
Assume you have added jfxrt.jar into reference libraries...
Now
Right Click your Project -> Properities -> Run/Debug Settings -> Click the Css2Bin ->
Main Class:
Click the Search button
to change com.sun.javafx.css.parser.Css2Bin into your project main class
and
Mark the checkbox
Now be happy!
I had this same problem (in e(fx)clipse). I tried the solution mentioned above and still had the same problem. I added a new run configuration and pointed it directly to the class thar had Main and that worked for me.