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

How to use
getProperty
method
in
java.lang.System

Best Java code snippets using java.lang.System.getProperty (Showing top 20 results out of 121,842)

origin: stackoverflow.com

 public class JavaApplication1 {
 public static void main(String[] args) {
    System.out.println("Working Directory = " +
       System.getProperty("user.dir"));
 }
}
origin: spring-projects/spring-framework

/**
 * Get the <em>profile value</em> indicated by the specified key from the
 * system properties.
 * @see System#getProperty(String)
 */
@Override
public String get(String key) {
  Assert.hasText(key, "'key' must not be empty");
  return System.getProperty(key);
}
origin: google/guava

/**
 * Writes the given lines of text to this sink with each line (including the last) terminated with
 * the operating system's default line separator. This method is equivalent to {@code
 * writeLines(lines, System.getProperty("line.separator"))}.
 *
 * @throws IOException if an I/O error occurs while writing to this sink
 * @since 22.0
 */
@Beta
public void writeLines(Stream<? extends CharSequence> lines) throws IOException {
 writeLines(lines, System.getProperty("line.separator"));
}
origin: google/guava

/**
 * Writes the given lines of text to this sink with each line (including the last) terminated with
 * the operating system's default line separator. This method is equivalent to {@code
 * writeLines(lines, System.getProperty("line.separator"))}.
 *
 * @throws IOException if an I/O error occurs while writing to this sink
 */
public void writeLines(Iterable<? extends CharSequence> lines) throws IOException {
 writeLines(lines, System.getProperty("line.separator"));
}
origin: google/guava

/**
 * Returns the current value for this system property by delegating to {@link
 * System#getProperty(String)}.
 */
public @Nullable String value() {
 return System.getProperty(key);
}
origin: google/guava

public void testWriteLinesStream_systemDefaultSeparator() throws IOException {
 String separator = System.getProperty("line.separator");
 sink.writeLines(lines.stream());
 assertContainsExpectedLines(separator);
}
origin: spring-projects/spring-framework

@BeforeClass
public static void compilerAssumptions() {
  // JiBX compiler is currently not compatible with JDK 9
  Assume.assumeTrue(System.getProperty("java.version").startsWith("1.8."));
}
origin: spring-projects/spring-framework

@BeforeClass
public static void compilerAssumptions() {
  // JiBX compiler is currently not compatible with JDK 9
  Assume.assumeTrue(System.getProperty("java.version").startsWith("1.8."));
}
origin: google/guava

public void testWriteLines_stream() throws IOException {
 sink.writeLines(ImmutableList.of("foo", "bar", "baz").stream());
 String separator = System.getProperty("line.separator");
 assertEquals("foo" + separator + "bar" + separator + "baz" + separator, sink.getString());
}
origin: google/guava

public void testWriteLines_systemDefaultSeparator() throws IOException {
 String separator = System.getProperty("line.separator");
 sink.writeLines(lines);
 assertContainsExpectedLines(separator);
}
origin: spring-projects/spring-framework

@Test
public void verifyPropertiesAreAvailableInEnvironment() {
  String userHomeKey = "user.home";
  assertEquals(System.getProperty(userHomeKey), env.getProperty(userHomeKey));
  assertEquals("enigma", env.getProperty("explicit"));
}
origin: spring-projects/spring-framework

@Test
@EnabledOnMac
void enabledIfWithSpelOsCheckInCustomComposedAnnotation() {
  String os = System.getProperty("os.name").toLowerCase();
  assertTrue(os.contains("mac"), "This test must be enabled on Mac OS");
  assertFalse(os.contains("win"), "This test must be disabled on Windows");
}
origin: google/guava

public void testWriteLines_withDefaultSeparator() throws IOException {
 sink.writeLines(ImmutableList.of("foo", "bar", "baz"));
 String separator = System.getProperty("line.separator");
 assertEquals("foo" + separator + "bar" + separator + "baz" + separator, sink.getString());
}
origin: spring-projects/spring-framework

@Test
@DisabledOnMac
void disabledIfWithSpelOsCheckInCustomComposedAnnotation() {
  assertFalse(System.getProperty("os.name").contains("Mac"), "This test must be disabled on Mac OS");
}
origin: spring-projects/spring-framework

@Parameterized.Parameters(name = "server [{0}]")
public static Object[][] arguments() {
  File base = new File(System.getProperty("java.io.tmpdir"));
  return new Object[][] {
      {new JettyHttpServer()},
      {new ReactorHttpServer()},
      {new TomcatHttpServer(base.getAbsolutePath())},
      {new UndertowHttpServer()}
  };
}
origin: spring-projects/spring-framework

@Test
public void testPropertyPlaceholderConfigurerWithSystemPropertyFallback() {
  factory.registerBeanDefinition("tb", genericBeanDefinition(TestBean.class)
      .addPropertyValue("country", "${os.name}").getBeanDefinition());
  PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
  ppc.postProcessBeanFactory(factory);
  TestBean tb = (TestBean) factory.getBean("tb");
  assertEquals(System.getProperty("os.name"), tb.getCountry());
}
origin: google/guava

public void testGetValue() {
 for (StandardSystemProperty property : StandardSystemProperty.values()) {
  assertEquals(System.getProperty(property.key()), property.value());
 }
}
origin: spring-projects/spring-framework

@Test
public void testCustomDestroyBean() throws Exception {
  beanFactory.getBean("custom-destroy");
  beanFactory.destroySingletons();
  assertNull(System.getProperty("security.destroy"));
}
origin: spring-projects/spring-framework

@Test
public void testSpringDestroyBean() throws Exception {
  beanFactory.getBean("spring-destroy");
  beanFactory.destroySingletons();
  assertNull(System.getProperty("security.destroy"));
}
origin: spring-projects/spring-framework

@Test
public void testCustomFactoryType() throws Exception {
  assertNull(beanFactory.getType("spring-factory"));
  assertNull(System.getProperty("factory.object.type"));
}
java.langSystemgetProperty

Javadoc

Returns the value of a particular system property or null if no such property exists.

The following properties are always provided by the Dalvik VM:

Name Meaning Example
file.separator java.io.File#separator /
java.class.path System class path .
java.class.version (Not useful on Android) 50.0
java.compiler (Not useful on Android) Empty
java.ext.dirs (Not useful on Android) Empty
java.home Location of the VM on the file system /system
java.io.tmpdir See java.io.File#createTempFile /sdcard
java.library.path Search path for JNI libraries /vendor/lib:/system/lib
java.vendor Human-readable VM vendor The Android Project
java.vendor.url URL for VM vendor's web site http://www.android.com/
java.version (Not useful on Android) 0
java.specification.version VM libraries version 0.9
java.specification.vendor VM libraries vendor The Android Project
java.specification.name VM libraries name Dalvik Core Library
java.vm.version VM implementation version 1.2.0
java.vm.vendor VM implementation vendor The Android Project
java.vm.name VM implementation name Dalvik
java.vm.specification.version VM specification version 0.9
java.vm.specification.vendor VM specification vendor The Android Project
java.vm.specification.name VM specification name Dalvik Virtual Machine Specification
line.separator The system line separator \n
os.arch OS architecture armv7l
os.name OS (kernel) name Linux
os.version OS (kernel) version 2.6.32.9-g103d848
path.separator See java.io.File#pathSeparator :
user.dir Base of non-absolute paths /
user.home (Not useful on Android) Empty
user.name (Not useful on Android) Empty

It is a mistake to try to override any of these. Doing so will have unpredictable results.

Popular methods of System

  • currentTimeMillis
    Returns the current time in milliseconds. Note that while the unit of time of the return value is a
  • 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
  • getenv
    Returns the value of the environment variable with the given name, or null if no such variable exist
  • 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

  • Finding current android device location
  • addToBackStack (FragmentTransaction)
  • getSystemService (Context)
  • setContentView (Activity)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • JPanel (javax.swing)
  • Top Vim 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