JavaFX in Eclipse Helios: IllegalArgumentException

2019-03-02 19:55发布

I got this error while trying to start and make javafx 2.0 in eclipse helios

Exception in thread "main" java.lang.IllegalArgumentException: expected file name as argument
at com.sun.javafx.css.parser.Css2Bin.main(Css2Bin.java:44)

Recently I'm following step-by-step to Getting Started with JavaFX 2.0 in Eclipse IDE from this - website
I don't know how to fix it, can somebody help me? Thanks

标签: javafx-2
8条回答
▲ chillily
2楼-- · 2019-03-02 20:10

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.

查看更多
家丑人穷心不美
3楼-- · 2019-03-02 20:10

we can run as the Appllcation to solve the problem

查看更多
做自己的国王
4楼-- · 2019-03-02 20:11

This problem comes from Css2Bin being set as the application to run. This means that eclipse tries to run Css2Bin as your main application and Css2Bin crashes when it doesn't receive any command line arguments.

Easiest way to solve this is to remove Css2Bin from you run/debug settings (project settings) and add one where you select your own application in the menus.

查看更多
等我变得足够好
5楼-- · 2019-03-02 20:11

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();

    }

}

查看更多
劳资没心,怎么记你
6楼-- · 2019-03-02 20:23

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/

查看更多
Viruses.
7楼-- · 2019-03-02 20:27
  • Add the jfxrt.jar to Build Path
  • Go to properties jfxrt.jar in Referenced Libraries
  • GO to Run/Debug Settings>Css2Bin
  • Mark the check box:
    • Include system libraries when searching for a main class
    • Include inherited mains when searching for a main class

Now be happy!

查看更多
登录 后发表回答