Tabnine Logo
System.getenv
Code IndexAdd Tabnine to your IDE (free)

How to use
getenv
method
in
java.lang.System

Best Java code snippets using java.lang.System.getenv (Showing top 20 results out of 29,133)

origin: apache/incubator-dubbo

@Override
public Object getInternalProperty(String key) {
  return System.getenv(key);
}
origin: apache/incubator-dubbo

@Override
public Object getInternalProperty(String key) {
  return System.getenv(key);
}
origin: jenkinsci/jenkins

public BuildIDs call() throws IOException {
  job = System.getenv("JOB_NAME");
  number = System.getenv("BUILD_NUMBER");
  id = System.getenv("BUILD_ID");
  return this;
}
origin: jenkinsci/jenkins

  public String[] call() throws IOException {
    return new String[] {
      System.getenv("JOB_NAME"),
      System.getenv("BUILD_NUMBER")
    };
  }
}
origin: ctripcorp/apollo

private String getProperty(String name) {
 String value = null;
 value = System.getProperty(name);
 if (value == null) {
  value = System.getenv(name);
 }
 return value;
}
origin: spring-projects/spring-framework

  @Override
  @Nullable
  public String resolvePlaceholder(String placeholderName) {
    try {
      String propVal = System.getProperty(placeholderName);
      if (propVal == null) {
        // Fall back to searching the system environment.
        propVal = System.getenv(placeholderName);
      }
      return propVal;
    }
    catch (Throwable ex) {
      System.err.println("Could not resolve placeholder '" + placeholderName + "' in [" +
          this.text + "] as system property: " + ex);
      return null;
    }
  }
}
origin: jenkinsci/jenkins

public String[] getEnv() {
  Map<String,String> envs = System.getenv();
  String[] envp = new String[envs.size()];
  
  int i = 0;
  for (Map.Entry<String,String> e : envs.entrySet()) {
    envp[i++] = e.getKey()+'+'+e.getValue();
  }
  return envp;
}
origin: apache/incubator-dubbo

/**
 * System environment -> System properties
 *
 * @param key key
 * @return value
 */
public static String getSystemProperty(String key) {
  String value = System.getenv(key);
  if (StringUtils.isEmpty(value)) {
    value = System.getProperty(key);
  }
  return value;
}
origin: apache/incubator-dubbo

/**
 * System environment -> System properties
 *
 * @param key key
 * @return value
 */
public static String getSystemProperty(String key) {
  String value = System.getenv(key);
  if (StringUtils.isEmpty(value)) {
    value = System.getProperty(key);
  }
  return value;
}
origin: netty/netty

private static File locateHostsFile() {
  File hostsFile;
  if (PlatformDependent.isWindows()) {
    hostsFile = new File(System.getenv("SystemRoot") + WINDOWS_HOSTS_FILE_RELATIVE_PATH);
    if (!hostsFile.exists()) {
      hostsFile = new File(WINDOWS_DEFAULT_SYSTEM_ROOT + WINDOWS_HOSTS_FILE_RELATIVE_PATH);
    }
  } else {
    hostsFile = new File(X_PLATFORMS_HOSTS_FILE_PATH);
  }
  return hostsFile;
}
origin: spring-projects/spring-framework

  @Override
  @Nullable
  protected String getSystemAttribute(String attributeName) {
    try {
      return System.getenv(attributeName);
    }
    catch (AccessControlException ex) {
      if (logger.isInfoEnabled()) {
        logger.info("Caught AccessControlException when accessing system environment variable '" +
            attributeName + "'; its value will be returned [null]. Reason: " + ex.getMessage());
      }
      return null;
    }
  }
};
origin: jenkinsci/jenkins

@Override
public boolean canWork() {
  try {
    exe = System.getenv("WINSW_EXECUTABLE");
    if (exe==null)
      return false;   // not under winsw
    return exec("status") ==0;
  } catch (InterruptedException | IOException e) {
    LOGGER.log(FINE, getClass()+" unsuitable", e);
    return false;
  }
}
origin: apache/incubator-dubbo

public static Properties getProperties() {
  if (PROPERTIES == null) {
    synchronized (ConfigUtils.class) {
      if (PROPERTIES == null) {
        String path = System.getProperty(Constants.DUBBO_PROPERTIES_KEY);
        if (path == null || path.length() == 0) {
          path = System.getenv(Constants.DUBBO_PROPERTIES_KEY);
          if (path == null || path.length() == 0) {
            path = Constants.DEFAULT_DUBBO_PROPERTIES;
          }
        }
        PROPERTIES = ConfigUtils.loadProperties(path, false, true);
      }
    }
  }
  return PROPERTIES;
}
origin: apache/incubator-dubbo

public static Properties getProperties() {
  if (PROPERTIES == null) {
    synchronized (ConfigUtils.class) {
      if (PROPERTIES == null) {
        String path = System.getProperty(Constants.DUBBO_PROPERTIES_KEY);
        if (path == null || path.length() == 0) {
          path = System.getenv(Constants.DUBBO_PROPERTIES_KEY);
          if (path == null || path.length() == 0) {
            path = Constants.DEFAULT_DUBBO_PROPERTIES;
          }
        }
        PROPERTIES = ConfigUtils.loadProperties(path, false, true);
      }
    }
  }
  return PROPERTIES;
}
origin: jenkinsci/jenkins

private static final File getBaseDir() {
  File baseDir;
  
  String baseEnv = System.getenv("BASE");
  if (baseEnv != null) {
    baseDir = new File(baseEnv);
  } else {
    LOGGER.log(Level.WARNING, "Could not find environment variable 'BASE' for Jenkins base directory. Falling back to JENKINS_HOME");
    baseDir = Jenkins.getInstance().getRootDir();
  }
  return baseDir;
}
origin: libgdx/libgdx

@Override
public Preferences getPreferences (String name) {
  File libraryPath = new File(System.getenv("HOME"), "Library");
  File finalPath = new File(libraryPath, name + ".plist");
  @SuppressWarnings("unchecked")
  NSMutableDictionary<NSString, NSObject> nsDictionary = (NSMutableDictionary<NSString, NSObject>)NSMutableDictionary
    .read(finalPath);
  // if it fails to get an existing dictionary, create a new one.
  if (nsDictionary == null) {
    nsDictionary = new NSMutableDictionary<NSString, NSObject>();
    nsDictionary.write(finalPath, false);
  }
  return new IOSPreferences(nsDictionary, finalPath.getAbsolutePath());
}
origin: libgdx/libgdx

@Override
public Preferences getPreferences (String name) {
  File libraryPath = new File(System.getenv("HOME"), "Library");
  File finalPath = new File(libraryPath, name + ".plist");
  String path = libraryPath + "/" + name + ".plist";
  NSMutableDictionary<String, Object> nsDictionary = NSMutableDictionary.dictionaryWithContentsOfFile(path);
  // if it fails to get an existing dictionary, create a new one.
  if (nsDictionary == null) {
    nsDictionary = (NSMutableDictionary<String, Object>)NSMutableDictionary.alloc().init();
    nsDictionary.writeToFileAtomically(path, false);
  }
  return new IOSPreferences(nsDictionary, finalPath.getAbsolutePath());
}
origin: libgdx/libgdx

@Override
public Preferences getPreferences (String name) {
  File libraryPath = new File(System.getenv("HOME"), "Library");
  File finalPath = new File(libraryPath, name + ".plist");
  String path = libraryPath + "/" + name + ".plist";
  NSMutableDictionary<String, Object> nsDictionary = NSMutableDictionary.dictionaryWithContentsOfFile(path);
  // if it fails to get an existing dictionary, create a new one.
  if (nsDictionary == null) {
    nsDictionary = (NSMutableDictionary<String, Object>)NSMutableDictionary.alloc().init();
    nsDictionary.writeToFileAtomically(path, false);
  }
  return new IOSPreferences(nsDictionary, finalPath.getAbsolutePath());
}
origin: jenkinsci/jenkins

  private static EnvVars initMaster() {
    EnvVars vars = new EnvVars(System.getenv());
    vars.platform = Platform.current();
    if(Main.isUnitTest || Main.isDevelopmentMode)
      // if unit test is launched with maven debug switch,
      // we need to prevent forked Maven processes from seeing it, or else
      // they'll hang
      vars.remove("MAVEN_OPTS");
    return vars;
  }
}
origin: spring-projects/spring-framework

@Test
public void testReplaceFromEnv() {
  Map<String,String> env = System.getenv();
  if (env.containsKey("PATH")) {
    String text = "${PATH}";
    assertEquals(env.get("PATH"), SystemPropertyUtils.resolvePlaceholders(text));
  }
}
java.langSystemgetenv

Javadoc

Returns an unmodifiable map of all environment variables to their values.

Popular methods of System

  • currentTimeMillis
    Returns the current time in milliseconds. Note that while the unit of time of the return value is a
  • getProperty
    Returns the value of a particular system property. The defaultValue will be returned if no such prop
  • arraycopy
  • exit
  • setProperty
    Sets the value of a particular system property.
  • nanoTime
    Returns the current timestamp of the most precise timer available on the local system, in nanosecond
  • getProperties
    Returns the system properties. Note that this is not a copy, so that changes made to the returned Pr
  • identityHashCode
    Returns an integer hash code for the parameter. The hash code returned is the same one that would be
  • getSecurityManager
    Gets the system security interface.
  • gc
    Indicates to the VM that it would be a good time to run the garbage collector. Note that this is a h
  • lineSeparator
    Returns the system's line separator. On Android, this is "\n". The value comes from the value of the
  • clearProperty
    Removes a specific system property.
  • lineSeparator,
  • clearProperty,
  • setOut,
  • setErr,
  • console,
  • loadLibrary,
  • load,
  • setSecurityManager,
  • mapLibraryName

Popular in Java

  • Reading from database using SQL prepared statement
  • getSharedPreferences (Context)
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JList (javax.swing)
  • JPanel (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now