2016-10-02 83 views

回答

0

对于Web应用程序,您可以在web.xml<init-param><context-param>初始化一些参数,或使用ServletContextListener

对于命令行应用:

右键单击项目节点,选择属性。 选择运行类别。

Command line arguments

+0

是的,这是我的尝试,..但你可以看到我的选项(添加到原始文章) – miro

+0

你选择了一个Web应用程序,而不是一个命令行应用程序。 –

0

如果你的项目是一个Maven项目,你可以使用EXEC - Maven的插件

 <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 
      <version>1.5.0</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>java</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <mainClass>org.something.Main</mainClass><!--change to your class with main method here--> 
       <arguments> 
        <argument>-r</argument><!-- argument -r --> 
        <argument>bar</argument><!-- argument bar --> 
       </arguments> 
      </configuration> 
     </plugin>