Solved

program vs VM arguments

Posted on 2014-01-31
6
386 Views
Last Modified: 2014-02-03
Hi,

i am looking into below program.

As in the screenshot

http://www.avajava.com/tutorials/lessons/how-do-i-set-system-properties.html?page=2

VM arguments author passing
-Dfavorite.day=Saturday -Dfavorite.car="Nissan 350Z"


My question can i pass them instead of VM arguments as program arguments text box(the one above VM arguments)
What are advantages, disadvantages of each of them.
please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 27

Expert Comment

by:rrz
ID: 39825224
Yes, you can pass them as program arguments.  
To read them you would use something like  
String  favoriteDay  = args[0];
String favoriteCar  = args[1];    
that is purposeof args[] in the line  
      public static void main(String[] args) {
0
 
LVL 7

Author Comment

by:gudii9
ID: 39825263
What are differneces, advantages, disadvantages of VM and System Arguments
0
 
LVL 27

Expert Comment

by:rrz
ID: 39825307
I guess you read in the same web site  
http://www.avajava.com/tutorials/lessons/whats-the-difference-between-program-arguments-and-vm-arguments.html       
System arguments apply to the system.
Program arguments apply to your specific program.  
It all depends on what you trying to do.    
Hopefully an expert will have some more to say about it.
0
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
LVL 6

Assisted Solution

by:Mahesh Bhutkar
Mahesh Bhutkar earned 150 total points
ID: 39828872
Program arguments are arguments passed to your program and available in the args array of your main method.
public static void main(String[] args)

VM arguments are passed to the virtual machine. They can be accessed by program via a call to System.getProperty().
0
 
LVL 7

Author Comment

by:gudii9
ID: 39829839
which one is preferred to use in which case. please advise. why do we need to pass to virtual machine.what is the use case / practical use for that.
0
 
LVL 27

Accepted Solution

by:
rrz earned 350 total points
ID: 39829965
>which one is preferred to use in which case    
In the code you linked to at the top, it is a  kind of  a misuse to set system properties for parameters that will be used in just one class.
The Java platform itself uses a Properties object to maintain its own configuration. The System class maintains a Properties object that describes the configuration of the current working environment. System properties include information about the current user, the current version of the Java runtime, and the character used to separate components of a file path name.
that is a quote from  
http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html   
On that page, you can see commonly used system properties.
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question