java: get runtime environment

发布时间 2023-11-15 06:32:13作者: ®Geovin Du Dream Park™

 

/**
 * encoding: utf-8
 * 版权所有 2023 涂聚文有限公司
 * 许可信息查看:
 * Java开源框架和库
 * http://projects.apache.org
 * https://eclipse.org/projects
 * http://spring.io/projects
 * https://redhatofficial.github.io
 * https://sourceforge.net
 * https://github.com
 * https://bitbucket.org
 * https://gitlab.org
 * https//search.maven.org
 * http://darwinsys.com/jwf
 * JSF附加库
 * https://bootsfaces.net
 * http://butterfaces.org
 * http://icefaces.org
 * http://openfaces.org
 * http://primefaces.org
 * http://richfaces.org
 * http://deltaspike.apache.org
 * http://www.jboss.org/jsfunit/
 * http://omnifaces.org
 *
 * 描述:
 * # Author    : geovindu,Geovin Du 涂聚文.
 * # IDE       : IntelliJ IDEA 2023.1 Java 17
 * # Datetime  : 2023 - 2023/11/15 - 6:02
 * # User      : geovindu
 * # Product   : IntelliJ IDEA
 * # Project   : javademo
 * # File      : Env.java  类
 * # explain   : 学习
 **/

package Common;


//import com.darwinsys.*;

public class Env {

    /**
     *
     * @return
     */
    public  static String getEnv()
    {
        return ("system.getenv(\"path\")="+System.getenv("PATH"));
    }

    /**
     *
     * @return
     */
    public  static String getColor()
    {
        String str=System.getProperty("pencil_color");
        return str;
    }

    /**
     *遍历系统属性信息
     */
    public  static void getEnvList()
    {
        System.getProperties().forEach((k,v)->System.out.println(k+"->"+v));

    }
}

  Java Cookbook