JavaFX in Eclipse Helios: IllegalArgumentException (Css2Bin.java:44)

前端 未结 8 2139
闹比i
闹比i 2020-12-21 23:34

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

Exception in thread "main" java.lang.IllegalArgumentException: expected         


        
相关标签:
8条回答
  • 2020-12-22 00:15

    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/

    0 讨论(0)
  • 2020-12-22 00:16

    Well, these answers seem to say what you need to do, but they're not very straight-forward.

    1. You right click the project, and click Properties.
    2. Select Run/Debug Settings.
    3. Click Css2Bin.
    4. Delete it.

    Trust me I tried it and it works.

    0 讨论(0)
  • 2020-12-22 00:16

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

    }

    0 讨论(0)
  • 2020-12-22 00:22

    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

    • Include system libraries when searching for a main class
    • Include inherited mains when searching for a main class
    0 讨论(0)
  • 2020-12-22 00:32
    • 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!

    0 讨论(0)
  • 2020-12-22 00:32

    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.

    0 讨论(0)
提交回复
热议问题