#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
Nesta página do site você pode assistir ao vídeo on-line Difference - What is Program Arguments and VM Arguments | Java Programming Tutorial duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário TechTalk Debu 18 Janeiro 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 8,889 vezes e gostou 94 espectadores. Boa visualização!