<small id='s32Wb'></small><noframes id='s32Wb'>

    1. <i id='s32Wb'><tr id='s32Wb'><dt id='s32Wb'><q id='s32Wb'><span id='s32Wb'><b id='s32Wb'><form id='s32Wb'><ins id='s32Wb'></ins><ul id='s32Wb'></ul><sub id='s32Wb'></sub></form><legend id='s32Wb'></legend><bdo id='s32Wb'><pre id='s32Wb'><center id='s32Wb'></center></pre></bdo></b><th id='s32Wb'></th></span></q></dt></tr></i><div id='s32Wb'><tfoot id='s32Wb'></tfoot><dl id='s32Wb'><fieldset id='s32Wb'></fieldset></dl></div>

    2. <legend id='s32Wb'><style id='s32Wb'><dir id='s32Wb'><q id='s32Wb'></q></dir></style></legend>

      <tfoot id='s32Wb'></tfoot>

        <bdo id='s32Wb'></bdo><ul id='s32Wb'></ul>
    3. 在 Java 中访问 shell 环境变量

      Access shell environment variables in Java(在 Java 中访问 shell 环境变量)
        <bdo id='0N4EX'></bdo><ul id='0N4EX'></ul>
          <tbody id='0N4EX'></tbody>

          <tfoot id='0N4EX'></tfoot>

          • <legend id='0N4EX'><style id='0N4EX'><dir id='0N4EX'><q id='0N4EX'></q></dir></style></legend>

            <small id='0N4EX'></small><noframes id='0N4EX'>

            1. <i id='0N4EX'><tr id='0N4EX'><dt id='0N4EX'><q id='0N4EX'><span id='0N4EX'><b id='0N4EX'><form id='0N4EX'><ins id='0N4EX'></ins><ul id='0N4EX'></ul><sub id='0N4EX'></sub></form><legend id='0N4EX'></legend><bdo id='0N4EX'><pre id='0N4EX'><center id='0N4EX'></center></pre></bdo></b><th id='0N4EX'></th></span></q></dt></tr></i><div id='0N4EX'><tfoot id='0N4EX'></tfoot><dl id='0N4EX'><fieldset id='0N4EX'></fieldset></dl></div>
                本文介绍了在 Java 中访问 shell 环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                有谁知道如何在 Java 中访问标准 shell 环境的环境变量?我正在使用 ProcessBuilder 类,我必须指定在我正在运行的 shell 脚本中使用的特定环境变量,这些变量存在于标准 shell 环境中.

                Does anyone know how to access the environment variables of the standard shell environment in Java? I am using the ProcessBuilder class and I have to specify specific environment variables used in a shell script I am running, these variables exist in the standard shell environment.

                无法访问 ProcessBuilder 环境.

                Accessing ProcessBuilder environment does not work.

                推荐答案

                您可以通过System.getenv()获取程序创建时存在的环境变量:

                You can get at the environment variables that existed when your program was created through System.getenv():

                http://download.oracle.com/javase/tutorial/基本/环境/env.html

                当 Java 应用程序使用 ProcessBuilder 对象创建新进程时,传递给新进程的默认环境变量集与提供给应用程序的虚拟机进程的环境变量集相同.应用程序可以使用 ProcessBuilder.environment 更改此设置.

                When a Java application uses a ProcessBuilder object to create a new process, the default set of environment variables passed to the new process is the same set provided to the application's virtual machine process. The application can change this set using ProcessBuilder.environment.

                看起来您的子进程应该会自动获取您的环境.

                It looks like your child process should get your environment automatically.

                这篇关于在 Java 中访问 shell 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                • <bdo id='Qh2aF'></bdo><ul id='Qh2aF'></ul>
                • <legend id='Qh2aF'><style id='Qh2aF'><dir id='Qh2aF'><q id='Qh2aF'></q></dir></style></legend>
                      <tbody id='Qh2aF'></tbody>
                    • <small id='Qh2aF'></small><noframes id='Qh2aF'>

                      <i id='Qh2aF'><tr id='Qh2aF'><dt id='Qh2aF'><q id='Qh2aF'><span id='Qh2aF'><b id='Qh2aF'><form id='Qh2aF'><ins id='Qh2aF'></ins><ul id='Qh2aF'></ul><sub id='Qh2aF'></sub></form><legend id='Qh2aF'></legend><bdo id='Qh2aF'><pre id='Qh2aF'><center id='Qh2aF'></center></pre></bdo></b><th id='Qh2aF'></th></span></q></dt></tr></i><div id='Qh2aF'><tfoot id='Qh2aF'></tfoot><dl id='Qh2aF'><fieldset id='Qh2aF'></fieldset></dl></div>

                        <tfoot id='Qh2aF'></tfoot>