In Java, for a normal main method :
public static void main(String[] args){
// code here
}
String[] args is used to take some parameters from command line. I can run this file from command prompt by :
javac filename.java
java filename -30
But, it takes more steps, and I must cd to this folder. (to long for each time). So, Does anyway to run this file with some arguments for main in Eclipse.
Thanks :)
解决方案
In Eclipse you can set up a Run Configuration for the Java Application. Click on the green "play" button in the Launch toolbar (next to the bug icon which starts debugging).
Within that configuration, you can set the working directory and command line arguments - and even prompt the user for command line arguments when it's run, using arguments like ${string_prompt:Foo}.