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

Pubblicato il: 18 gennaio 2020
sul canale di: 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


In questa pagina del sito puoi guardare il video online Difference - What is Program Arguments and VM Arguments | Java Programming Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato TechTalk Debu 18 gennaio 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 8,889 volte e gli è piaciuto 94 spettatori. Buona visione!