如何在Eclipse使用命令行参数

How To Use Command Line Arguments in Eclipse

如何在Eclipse使用命令行参数 


  1. 按下图操作
        Click on Run -> Run (not Run Last Launched).In the window shown below,
        notice that the Welcome Java application is highlighted.

    In the large subwindow of the Run window, there is a set of tabs,
        labelled Main, Arguments, JRE, etc.
    Notice that the Main tab is highlighted.

    如何在Eclipse使用命令行参数

  2. Click on the Arguments tab.
    This action brings up a window
        with a few places to enter values.
    You want to type in all your input values
        into the Program arguments window,
            with spaces (blank characters) between each value.For the Welcome program,
        only one input argument value is needed:
            the first name of a new Java student.
    For this run, we have chosen Sarah as
            the name of this student.
     
    Notice where it has been typed in.
        This is where all command line arguments should be entered.
    These values remain the same for all runs,
        until they are changed in this same window.

    如何在Eclipse使用命令行参数

  3. Then just click Apply, followed by Run.
        The screenshot below shows the output in the console window.如何在Eclipse使用命令行参数