[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

program vs VM arguments

Posted on 2014-01-31
6
Medium Priority
?
407 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 28

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 28

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 600 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 28

Accepted Solution

by:
rrz earned 1400 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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 …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

649 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