About the description order of Java system properties

I'm worried and remembered regularly, so make a note of it. "System property" that defines the amount of memory allocated to Java commands However, depending on the order of description, it is clear whether or not it can be referenced from the class.

environment

$java -version
java version "1.8.0_131"

** Sample class ** The system property "kusatest" is referenced from the class and output.

Test.java


import java.util.*;

public class Test {
    public static void main(String[] args) {
        System.out.println("start");
        System.out.println(System.getProperty("kusatest"));
        System.out.println("end");
    }
}

** Reference examples **

$ java -Dkusatest=a Test
start
a
end

** Examples that cannot be referenced **

$ java Test -Dkusatest=a
start
null
end

I wrote the class / Jar and wrote the properties later, so it was easy to make a mistake. I forget it every time and waste a few hours, so I want to remember it anymore.

Recommended Posts

About the description order of Java system properties
About the description of Docker-compose.yml
About the idea of anonymous classes in Java
The order of Java method modifiers is fixed
About the handling of Null
About an instance of java
About the operation of Java reading party BOF-held monthly since 1998
Traps brought about by the default implementation of the Java 8 interface
[Java] I thought about the merits and uses of "interface"
About the behavior of ruby Hash # ==
[Java] Delete the elements of List
About the basics of Android development
About fastqc of Biocontainers and Java
[Java version] The story of serialization
About Lambda, Stream, LocalDate of Java8
Explanation of the order of rails routes
About the current development environment (Java 8)
About the role of the initialize method
Think about the 7 rules of Optional
A brief description of JAVA dependencies
Order of processing in the program
The origin of Java lambda expressions
Summary about the introduction of Device
About the log level of java.util.logging.Logger
Let's talk about the passing experience of Java SE 8 Programmer II
Examine the system information of AWS Lambda operating environment in Java
[Java] Get the dates of the past Monday and Sunday in order
A story about hitting the League Of Legends API with JAVA
When I was worried about static methods in java interface, I arrived in the order of name interpretation
Member description order in Java coding convention
Get the result of POST in Java
About the version of Docker's Node.js image
Guess about the 2017 Java Persistence Framework (3) Reladomo
Check the contents of the Java certificate store
Examine the memory usage of Java elements
What is testing? ・ About the importance of testing
[Java] Get the day of the specific day of the week
Memo: [Java] Check the contents of the directory
About the classification and concept of Immutable / Mutable / Const / Variable of Java and Kotlin.
About the procedure for java to work
About the new Java release model @ Seki Java (2018/07/20)
About the operation of next () and nextLine ()
Compare the elements of an array (Java)
[day: 5] I summarized the basics of Java
About the initial display of Spring Framework
What are the updated features of java 13
Easily measure the size of Java Objects
Looking back on the basics of Java
About the error message Invalid redeclaration of'***'
[Java beginner] About initialization of multidimensional array
[Basic knowledge of Java] About type conversion
Output of the book "Introduction to Java"
About the treatment of BigDecimal (with reflection)
About the number of threads of Completable Future
The story of writing Java in Emacs
About the mechanism of the Web and HTTP
Java: Place the ResourceBundle properties file anywhere
[Java] Check the number of occurrences of characters
[Java] [Spring] Test the behavior of the logger
About the meaning of type variables, E, T, etc. used in generics used in Java
[No.004] Corrected the order list screen of the orderer