toogle sidebar button


jar tvf jarfile.jar - display content of file

System properties vs Environment variables

System properties are set on the java command line using the -Dpropertyname=value syntax. They can also be added at runtime using System.setProperty(name, value) or via the various System.getProperties().load() methods

Environment variables are set in the OS, eg in linux export HOME=/Users/myusername or on windows SET WINDIR=C:\Windows etc, and, unlike properties, may not be set at runtime.


To obtainn generic type from the current class:

    private Class<T> clazz;

    public Class<T> getClazzClass() {
        if (clazz == null) {
            this.clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
        return clazz;

Serialization / Deserialization to JSON


new; //serialization
new, Foo.class); //deserialization



new com.fasterxml.jackson.databind.ObjectMapper().writeValueAsString(var); //serialization
new com.fasterxml.jackson.databind.ObjectMapper().readValue(obj, MyObjectClass.class); //deserialization