I wanna re-run a jar file from its own (with some additional parameters). How can I do this?
I need the solution to be OS independent.
I wanna re-run a jar file from its own (with some additional parameters). How
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.
If I deciphered the question correctly, we are talking about command line interface arguments. For this there’s plenty tutorials: http://docs.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html
The code is simple, like you said yourself:
Now, depending on how you want to execute you program from the OS, there’s a number of ways:
Or
Same for the “-server”.
To run them together, either run them from separate terminal windows (or cmd prompts). Or – if in Linux – you can use ampersand: