Difference - What is Program Arguments and VM Arguments | Java Programming Tutorial

Veröffentlicht am: 18 Januar 2020
auf dem Kanal: TechTalk Debu
8,889
94

#Program vs #VM #Arguments

GitHub Account for Free Code download: https://github.com/admindebu
Follow me on FaceBook:   / techtalkdebu  
Instagram: techtalk_debu
LinkedIn :   / debu-paul  

if you like my video, please subscribe to my channel and share the video


First of all, there are two arguments: 1. Program argument and 2. VM Argument
Program Argument: Program arguments are arguments that are passed to your application, which are accessible via the "args" String array parameter of your main method. Example: any program related value or logging level information, etc we passed through program argument.
VM Arguments: VM arguments are arguments such as System properties that are passed to the JavaSW interpreter. Basically, this is the instruction to the JVM “do something”.You can do things like control the heap size, etc. They can be accessed by your program via a call to System.getProperty() as you described.

Code :
package com.techtalk.debu;

public class ProgramVsVMArgument {

public static void main(String[] args) {

// Program Argument pro1 pro2 pro3
System.out.println("Program Arguments:");
for (String arg : args) {
System.out.println("\t" + arg);
}

// VM Argument : -Dproperty1=techtalk -Dproperty2=debu
System.out.println("System Properties from VM Arguments");
String property1 = "property1";
System.out.println(property1 + " Value : " + System.getProperty(property1));
String property2 = "property2";
System.out.println(property2 + " Value : " + System.getProperty(property2));



}

}

Thanks & Regards,
Debu Paul


Auf dieser Seite können Sie das Online-Video Difference - What is Program Arguments and VM Arguments | Java Programming Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer TechTalk Debu 18 Januar 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 8,889 Mal angesehen und es wurde von 94 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!