zoukankan      html  css  js  c++  java
  • java程序启动参数-D含义详解

    -D<name>=<value>  :  set a system property  设置系统属性。

    官方解释:

    Set a system property value. If  value  is a string that contains spaces, you must enclose the string in double quotes:

    1.java -D参数简化加入多个jar

          java命令引入jar时可以-cp参数,但时-cp不能用通配符(多个jar时什么烦要一个个写,不能*.jar),面通常的jar都在同一目录,且多于1个。)-Djava.ext.dirs 就可以解决 多个jar的问题

    如:

    java -Djava.ext.dirs=lib MyClass  

     

    2.可以在运行前配置一些属性,比如其他属性

    java -Dconf1="wqbin" Myclass

    可以通过System.getProperty("conf1");获得这个值

    也可以从idea上看:

     

    3.补充Standard System Properties

    KeyMeaning
    "file.separator" Character that separates components of a file path. This is "/" on UNIX and "" on Windows.
    "java.class.path" Path used to find directories and JAR archives containing class files. Elements of the class path are separated by a platform-specific character specified in the path.separator property.
    "java.home" Installation directory for Java Runtime Environment (JRE)
    "java.vendor" JRE vendor name
    "java.vendor.url" JRE vender URL
    "java.version" JRE version number
    "line.separator" Sequence used by operating system to separate lines in text files
    "os.arch" Operating system architecture
    "os.name" Operating system name
    "os.version" Operating system version
    "path.separator" Path separator character used in java.class.path
    "user.dir" User working directory
    "user.home" User home directory
    "user.name" User account name

  • 相关阅读:
    LLVM 0: LLVM和Clang的背景
    semaphore和mutex的区别?
    Note: TWLKH: 浅谈Semaphore与mutex
    Bark:自建 iOS 消息推送服务
    aka.ms打不开
    《UNIX 传奇:历史与回忆》Note
    crawlab 实现批量添加爬虫的功能
    手机浏览器打开PC端网站,背景显示不全怎么办?
    jquery实现平滑的二级下拉菜单效果
    nginx服务器设置301重定向,不带www跳转到带www域名
  • 原文地址:https://www.cnblogs.com/wqbin/p/11600233.html
Copyright © 2011-2022 走看看