Running java program from command line

To run a java program from the command line you basically have to execute the compiled jar file. If you have compiled the .jar file then to run the .jar file containing your java program from the command line at the command prompt simply type

java -jar myjarfile.jar argument1 argument2

the arguments are optional.



That is all.

If you liked this article please do leave a reply and share it with friends.

Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.