Operating system environment variables

In Java, many classes areIterable, Mainly including allCollectionCategory (but not variousMaps). For example, the following code can display all operating system environment variables:

// collections/EnvironmentVariables.java
// {VisuallyInspectOutput}
import java.util.*;

public class EnvironmentVariables {
  public static void main(String[] args) {
    for(Map.Entry entry: System.getenv().entrySet()) {
      System.out.println(entry.getKey() + ": " +
        entry.getValue());
    }
  }
}
PATH: /Library/Frameworks/Python.framework/Versions/3.8/bin:/Users/chy/Library/apache-maven-3.6.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/chy/Library/tomcat9.27/bin
SHELL: /bin/bash
USER: wangyixuan
TMPDIR: /var/folders/_t/s_5zr51n5kv_qc8rkjn_d84h0000gn/T/
SSH_AUTH_SOCK: /private/tmp/com.apple.launchd.V3hV7RDf03/Listeners
XPC_FLAGS: 0x0
VERSIONER_PYTHON_VERSION: 2.7
__CF_USER_TEXT_ENCODING: 0x1F5:0x19:0x34
LOGNAME: wangyixuan
LC_CTYPE: zh_CN.UTF-8
M3_HOME: /Users/chy/Library/apache-maven-3.6.3
PWD: /Users/chy/Documents/JavaProject/Java8
XPC_SERVICE_NAME: com.jetbrains.intellij.1576
JAVA_MAIN_CLASS_16255: EnvironmentVariables
HOME: /Users/chy

System.getenv()Return oneMap , entrySet()Generate a causeMap.EntryComposed of the elementsSet, And thisSet Is an IterableSo it can be usedfor-inCirculation.for-inThe statement is applicable to arrays or any otherIterableBut this does not mean that the array must also be aIterable, There will be no automatic packing

Intelligent Recommendation

[Java] How to configure Java environment variables under Windows operating system

Everyone who learns Java first comes into contact with the configuration of environmental variables. Although the foundation is the only way to go. A brief summary is divided into the following steps:...

The basic operating system under Linux environment to build and python on variables

What is a python: Python (English pronunciation: / paɪθən / American pronunciation: / paɪθɑːn /), is an object-oriented interpretedComputer programming language,byDutchGuido van Rossum inv...

windows operating system environment variables _ _ set the JDK batch

Save the above to a text file (Note: Modify the JDK root directory of local installation path), and the file suffix changed to bat, you can double-click to run. Check to see if the success of two ways...

Under Windows operating system, open the application use environment variables

Environment Variables environmental variables (environment variables) generally refers to the number of parameters used to specify the operating environment of the operating system in the operating sy...

[Maven] Install and configure maven environment variables under Mac operating system

1. Download maven Download address: http://maven.apache.org/download.cgi 2. Unzip the Maven local address after decompression I put 3. Configure the environment. Edit profile file and add maven path O...

More Recommendation

Introduction to Python-Computer Basics-Operating System, Interaction, Environment Variables

== Introduction to Python-Computer Basics-Operating System, Interaction, Environment Variables == common sense Inside the computer, various information such as numerical values, text, sound, graphics ...

Eclipse application development (system variables, operating parameters, environment variable settings)

table of Contents 1. Usage scenarios 2. Configuration implementation 2.1. Operating parameters and VM variable settings: 2.2, environment variable settings 2.3, Google Cloud service related settings 3...

Understand environment variables (take Windows operating system as an example)

Environment variable The relationship between environment variables, user variables and system variables Understanding of environment variables Environment variables in Java Why need to configure envi...

Use winpe to backup the environment variables of the original operating system to the local

The computer system is crashing, and the system needs to be reinstalled. At this time, when I think of it, I want to back up a copy of the environment variables so that it is convenient to configure o...

Install JDK1.8 in Windows 10 operating system and configure environment variables

1. Download It’s best to download from the official website, you can also find other blog posts, I won’t repeat them here, I will provide you withjdk-8u101-windows-x64.exeThe installation ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top