zoukankan      html  css  js  c++  java
  • java Properties类得到当前的系统属性

    详见:http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt218

    package com.shi.simpleUtil;

    import java.util.Properties;

    /**

     * 得到系统的一些属性

     * @author grefr

     */

    public class PropertiesDemo {

           public static void main(String[] args) {

                 Properties initProp = new Properties(System.getProperties());  

             System.out.println("file.encoding----->:" +initProp.getProperty("file.encoding"));  

             System.out.println("user.language----->:" +initProp.getProperty("user.language"));

             System.out.println("user.dir----->:" +initProp.getProperty("user.dir"));

             //得到操作系统相关属性

             System.out.println( "OS name----->"+System.getProperty( "os.name"));

             System. out.println("OS arch----->"+System.getProperty("os.arch" ));

             System. out.println("OS version---->"+System.getProperty("os.version" )); 

             //得到编译后的class文件的路径

             System.out.println(System. getProperty( "java.class.path" ));

              //得到当前系统的换行符

             System.getProperty("line.separator");

          //段落分隔符 (;)

          System.getProperty("path.separator")

          }

    }

  • 相关阅读:
    超赞!不容错过的5款实用网页开发和设计工具
    如何从平面设计转行到UI设计?
    线段树
    RMQ
    Splay
    Treap
    *模板--矩阵
    最小生成树
    hash
    ac自动机
  • 原文地址:https://www.cnblogs.com/grefr/p/6094879.html
Copyright © 2011-2022 走看看