Oct 9, 2015

Textual description of firstImageUrl

Passing program arguments and VM arguments in Eclipse, Net beans and Command line

Sometimes when we execute out Java program/project, we need to pass arguments (program and VM). In this post we discusses how to pass these arguments in command line, Eclipse and Net beans. At the end of this post we will see how to pass VM arguments via pom.xml.

Pass program and VM arguments in eclipse:- 

Below program unit expects two program arguments and VM arguments(addProp and multProp).
 * @author devinline
public class ProgramAndVMParaametersPassing {
  *  program arguments are collected in string array referenced by args.
  *  VM arguments can be accessed by System.getProperty("ARGUMENT_NAME")
 public static void main(String[] args) {
  System.out.println("VM arguments addProp: "+ System.getProperty("addProp") 
     +" and multProp: "+ System.getProperty("multProp"));
  System.out.println("Program arguments are " + args[0] +  " and"+ args[1]);
   System.out.println("Sum of two program arguments are: " +
  else if(Boolean.parseBoolean(System.getProperty("multProp"))){
   System.out.println("Multiplication of two program arguments are: " + 

In eclipse program arguments and VM arguments can be passed from Run configurations.Follow following steps:-
Right click on project -> Go to Run As -> Run configurations.. and click on arguments tab.
Program arguments are added separated by spaces as shown in following diagram (14 12 added separated by spaces).
Similarly, VM arguments can be passed as -DKey = Value pair, we need to append -D in key and value can be any thing. For following program unit we passed two VM arguments as -DaddProp = true and -DmultProp= false
Program and VM arguments passing in eclipse 
 Note:-  "Error Could not find or load main class true"
No space is allowed between "key=value". If we give space between key and value like
-DaddProp = true  or 
DaddProp=  true , while running project or program we witness above error. Correct way of providing VM argument is :  -DKey=Value

Pass program and VM arguments in Net beans:- 

Right click on project and click properties. Click on Run in categories.
In arguments -  add program arguments 14 12 (separated by spaces)  and in VM Options-  add VM arguments (-DaddProp = true -DmultProp= false). Refer following diagram.
Program and VM arguments in Net beans

Pass program and VM arguments in Command line:- 

When we are executing java program form CMD, we can pass VM arguments and program arguments as follows:-
 java <vm_arguments> <java_class_name> <program_arguments>
Above program unit can be executed with VM and Program arguments as follows:-
java -DaddProp=true -DmultProp=false ProgramAndVMParaametersPassing 12 23
Program and VM arguments in command line

Pass VM arguments in pom.xml:- 

Sometimes we need to pass VM arguments via pom.xml. It can be done using "maven-sunfire-plugin". Following plugin node entry can be added to pass VM arguments via pom.xml. Under configuration we are passing two VM arguments -DaddProp=true and -DmultProp=false.


Location: Hyderabad, Telangana, India


  1. I admire this article for the well-researched content and excellent wording
    seo company in chennai

  2. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Project Centers in Chennai.

    Software management seeks for decision support to identify technologies like JavaScript that meet best the goals and characteristics of a software project or improvement programme. JavaScript Training in Chennai Accessible experiences and repositories that effectively guide that technology selection are still lacking.

    Aim of technology domain analysis is to describe the class of context situations (e.g., kinds of JavaScript software projects) in which a software engineering technology JavaScript Training in Chennai can be applied successfully

  3. i read your blog its very attractive and impressive thanks for sharing this post.
    professional seo sevices company

  4. i read your blog its very attractive and impressive thanks for sharing this post.

    Luxury Shoes Brand

  5. I feel extremely cheerful to have seen your post. I found the most beautiful and fascinating one. I am really extremely glad to visit your post.

  6. i read your blog its very attractive and impressive thanks for sharing this post. Check This

  7. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for.

  8. Keep up the wonderful piece of work, I read few posts on this internet site and I think that your blog is really interesting and holds bands of fantastic information. Kaamy.com

  9. Thanks for Sharing good information. I read few article among them it is a very informative. Franxx Hoodies

  10. https://jobss4u.com/chargeman-supply-wing-bs-12/

  11. Thanks for Sharing very good information. Please keep sharing.

  12. Damascus Steel Knives Store where you can buy premium quality knives. Damascus Axe

  13. Thanks for Sharing very good information. Please keep sharing. juice wrld shop

  14. Really very happy to say,your post is very interesting to read.I never stop myself to say something about it.You’re doing a great job.Keep it up.
    Darling in the franxx official store

  15. Its blog give information from another people very well I am impress its information an information is very nice.
    kanye west merch shop

  16. Lil Peep Merch Shop Official Merchandise Stor for Hoodies, Tshirts and Sweatshirts. Get Fast Shipping Around the World. Up to 50% Off.

  17. I feel extremely cheerful to have seen your post. I found the most beautiful and fascinating one. I am really extremely glad to visit your post.
    Juice Wrld 999 Hoodie Available on Best Juice Wrld Merch Shop. Shop Hoodies for all Age of Men and Women. Free Shipping Around the world.
    juice wrld 999 hoodie