I want my Java application to ask for specific arguments (like name and email) before running in Eclipse. How can I make it do that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not part of the Java code – it’s part of the run configuration.
Go to the Run drop down (the down-arrow next to the run button), select Run Configurations, and then find your program and select it.
Go to the Arguments tab, and then in the Program Arguments click on “Variables…” to get a list of possible variables for Eclipse to use. For example:
That will prompt the user for a value for “Foo” when you then run that configuration.