Solved

program vs VM arguments

Posted on 2014-01-31
6
380 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web application structure 18 133
Running JavaFX on JDeveloper 12C 1 109
Notify sent to other threads in Java 9 54
netbeans can not run self signed app 8 37
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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

739 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