Java processes

From wikinotes
Revision as of 02:40, 24 June 2022 by Will (talk | contribs) (Will moved page Java system to Java processes without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Environment Variables

import java.util.Map;

Map<String> env = System.getenv();    // get all environment variables
System.getenv("HOME");                // get environment variable "HOME" (returns String, or NULL)

NOTE:
java does not let you set environment variables, preferring that you spawn a subshell with a modified environment

Commandline Arguments

Java does not include an argument parser in it's standard library. I recommend apache's java commons cli.