score:57
Instead of just hitting the "Run" icon, select the dropdown box next to it, and choose "Run Configurations". Find your application (or create a Run Configuration for it) and put the command line arguments in the "Arguments" tab. See the docs for more information. It should look like this:
score:0
Run-> Run Configurations->Arguments->Enter your arguments separated by space->Apply->Run Ensure that the right project name and it's main method are selected under "the Main" tab under run configurations
score:0
this work for me, in public static void main method.
public static void main(String argv[]) throws Exception {
int port_com = 2;
boolean debugMode = true;
int socket = 6789;
HasarMain hasarMain = new HasarMain();
// Check if a command line argument exists
if(argv.length != 3){
System.out.println("Missing, Port - socket - debugMode!");
System.exit(0);
}
port_com = Integer.parseInt(argv[0]);
socket = Integer.parseInt(argv[1]);
debugMode = Boolean.parseBoolean(argv[2]);
Run-> Run Configurations->Arguments->Enter your arguments separated by tab->
${string_prompt:argv:"2" "6789" "true"}
score:3
From "Run" go to debug/run configurations. Click the tab called "Arguments". You can give the program arguments there.
score:3
Run configurations > Arguments tab. Just put "127.0.0.1" 9876
in the program arguments.
score:7
Want to add something like, how to add multiple parameters.
- Right-click on your project.
- Debug > Debug Configurations
- Go to Arguments tab.
- Enter in your Program Arguments, each separated by a new line. (e.g 3 arguments in attached image)
- Click Apply or Debug
Hope it helps.
score:11
- Right-click on your project.
- Go to Debug As > Debug Configurations or Run As > Run Configurations.
- Click the tab that says Arguments.
- Enter in your Program Arguments
- Click Apply or Debug
score:16
See the run configurations. You can specify arguments. You can even prompt the user for arguments, along with defaults:
${string_prompt:host:127.0.0.1} ${string_prompt:port:9876}
The first prompt is host, with default value 127.0.0.1 filled in. Second pop-up has the prmpt port, with 9876 filled in
Source: stackoverflow.com
Related Query
- How to pass console arguments to application in eclipse?
- How Eclipse Plugin can programmatically pass Java VM Arguments
- How to tell if a Java application is running within the Eclipse console (versus, for example, xterm)?
- How to pass JVM arguments in eclipse for Android programs?
- How to use console view in Eclipse RCP Application
- How to pass parameters to comman in eclipse rcp application through code?
- How to export my Console application to exe with eclipse
- Eclipse - how to pass VM arguments from command line (without changing eclipse.ini)
- How to output messages to the Eclipse console when developing for Android
- How do you stop Console from popping up automatically in Eclipse
- How to make Eclipse prompt me for command line arguments
- How to run Spring Boot web application in Eclipse itself?
- how to debug application as root in eclipse in Ubuntu?
- How to set eclipse console locale/language
- How to use the GDB console in Eclipse CDT?
- How do you connect an eclipse to a WebSphere Application server hosted on remote server?
- Eclipse 3.4.1 - how to view compiler output in Console while building a project
- How to deploy Java web application project from Eclipse to live Tomcat server?
- How can I redirect JNI console output to Eclipse Console view, when Eclipse plugin uses JNI?
- How to reuse menus in RCP application for Eclipse 4.2?
- How to set JVM arguments in tomcat that work both in eclipse and using the startup.bat
- How to profile a Java web application servlet call in Eclipse EE Luna
- How to use Eclipse interactive console in debug
- How can I make Eclipse output std:out to a standard windows console
- How to get the graphical layout Window back in Eclipse for Android Application Design?
- how to pass command line arguments to main method dynamically
- Eclipse : how we take arguments for main when run
- How to get Eclipse Console to hyperlink text to source code files?
- Eclipse - how to give the Java Console unlimited length (in # lines)
- How do I display unicode characters in the Eclipse console window?
More Query from same tag
- Getting "java.lang.OutOfMemoryError: Java heap space" while executing PIG scripts from Java application
- View of activity_main.xml does not show up in Graphical Layout of activity_main.xml
- OpenGL not supported by video driver
- Eclipse look&feel configuration in Ubuntu Linux
- Unresolved Dependency error in Eclipse
- C++ preprocessor variable defined in project configuration in eclipse, but invisible to C++ indexer
- Project build settings in Eclipse
- Eclipse(+AppEngine SDK) & Google "push-to-deploy" GIT repository
- Unwanted Dead Code Warning in Eclipse
- How to generate flowcharts in Eclipse?
- How do I get Eclipse to recognize R and the resources in Android's Lunar Lander?
- Visualize an embedded neo4j instance in a web browser using default visualization
- Which one is better (in support, difficulty, ...) to develop a plugin, Netbeans or Eclipse?
- Phonegap 3 and Eclipse - Why use together?
- Eclipse freeze accessing project -> properties -> android tab
- How to create a text file while running a jar file
- Access external project static web resources from Struts2.5 web server
- Best practice to rename a Java file with Eclipse/Subversive over Windows
- Modify Eclipse RCP startup args in protected directory
- Conversion numbers systems provides incorrect result
- UnsupportedClassVersionError use SwipeListView
- PouchDB with Windows Java development
- FitNesse: Enabling a FitNesse Fixture to call a method on the Server Side
- Trying to compile and debug FitNesse in Eclipse, using Gradle
- Eclipse e4 RCP BundleActivator
- How to create directory structure for gradle subProjects?
- java.lang.ClassNotFoundException: for org.json.simple.JSONObject
- Building multiple apks from on android app source
- Importing rules for PMD Eclipse
- A new version of Eclipse just came out. Is there anything I can do to avoid having to manually hunt down my plugins again?