Questions tagged [system-properties]

System properties a key value pairs that can be provided to an application, often used to configure it at run time.

In Java there is a set of predefined properties that specify things like operation system, java version and the current user. A complete list can be found at http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html

One can also provide arbitrary system properties when executing a java application using the -D commandline parameter like the following example:

java -Dkey=value ClassToExecute

Inside the program the properties can be accessed using System.getProperties() or similar methods in the same class.

260 questions
17
votes
4 answers

Jetty - set system property

I run webapp on Jetty. The configuration for the app come from file that lives on the same server where Jetty is running. Inside the app I rely on the system property to obtain path to the file so I can parse it. E.g. final String loc =…
Bostone
  • 36,858
  • 39
  • 167
  • 227
17
votes
6 answers

How do I detect whether the file system is case-sensitive?

I have a List of file names from a folder and a certain file name as String. I want to detect whether the file name is in the list, but need to respect the underlying file system's property of whether it is case-sensitive. Is there any easy…
Epaga
  • 38,231
  • 58
  • 157
  • 245
15
votes
3 answers

Can detect system Proxy Settings in Java application, but not in JUnit

Windows 7 Java 1.8.0_45 Eclipse Mars If you have system proxy set up to HTTP, the below will print HTTP only if it runs from main method of java application. However, if it is called from JUnit 4 test (in eclipse), it always prints DIRECT. It is…
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
14
votes
4 answers

When to use environment variables vs. system properties?

I wonder which of the following is a preferred approach? We can set things up as APP_HOME=/path/to/file (export in .profile or something along those lines) and access it as System.getenv("APP_HOME") Or, alternatively using properties as…
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
13
votes
3 answers

How do I set a system property for my project in sbt?

I'm sure I'm missing something really simple... I want to set the system property java.awt.headless to true for my sbt project. Reading the page on properties I think that I need to use system or systemOptional. In my project file I've tried things…
pr1001
  • 21,727
  • 17
  • 79
  • 125
12
votes
3 answers

Set a system property with ant

I have an ant script which has a taskdef and the task creates an https internet connection and somethin with that SSL stuff is wrong. Thus I want to set the system property javax.net.debug=all to get some more information. In java I would do this…
yankee
  • 38,872
  • 15
  • 103
  • 162
11
votes
3 answers

How to read Maven properties from JUnit test?

I'm using Maven 3.0.3 with JUnit 4.8.1. In my JUnit test, how do I read the project.artifactId defined in my Maven pom.xml file? In my pom, I have
Dave
  • 15,639
  • 133
  • 442
  • 830
11
votes
3 answers

What is the difference in properties java.runtime.version and java.version

For logging purposes I'm getting the Java version written in log while Java program is running. I found out that I can get the version with System.getProperty("java.runtime.version") -> 1.8.0_202-b08 and System.getProperty("java.version") ->…
Jokkeri
  • 1,001
  • 1
  • 13
  • 35
10
votes
5 answers

How to convert all Java System Properties to HashMap?

This nice article shows us how to print all the current system properties to STDOUT, but I need to convert everything that's in System.getProperties() to a HashMap. Hence if there is a system property called "baconator", with a value…
user1768830
9
votes
1 answer

System property "javax.xml.soap.MessageFactory" for two different soap versions

i need to communicate with two webservices from my application. For one webservice i need to use soap1_1 version and for the other soap version is soap1_2. In this case what should be the value set for the system property…
shaiksha
  • 993
  • 5
  • 17
  • 35
9
votes
3 answers

API to get android system properties is removed in arm64 platforms

I am using __system_property_get() from sys/system_properties.h to get a system property. I am trying to use r10c ndk because I need arm64 toolchain. __system_property_get() is defined in libc.so. Below is the readelf output of libc.so for…
kanak
  • 533
  • 1
  • 5
  • 8
9
votes
4 answers

Are Java system properties always non-null?

There are a couple of Java system properties, among them things like java.home and path.separator, user.home. The spec does not mention any formal promises on the existence of those values. Especially I am interested in user.home. Does it always…
miku
  • 181,842
  • 47
  • 306
  • 310
9
votes
1 answer

How to pass a system property to gradle with the jenkins gradle plugin?

I have a gradle tasks that deploys some stuff to bintray using curl. For this to work it needs my bintray api key. I don't want to put that in my build script (or a property file) since all this stuff is hosted in plain sight at github. Instead I…
Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
9
votes
1 answer

Java system Properties, http.proxyHost, two questions

I am developing a Java application that makes HTTP requests, and half of my development time is behind a proxy. So I have the following block in my code: if (BEHIND_PROXY) { java.util.Properties systemProperties = System.getProperties(); …
The111
  • 5,757
  • 4
  • 39
  • 55
8
votes
1 answer

Set system properties for Android application

Can I (in the Manifest file or somewhere else) set system properties for my Android application? I want to use a library that can be configured using system properties, and being able to just use that mechanism would reduce the amount of code I need…
Thilo
  • 257,207
  • 101
  • 511
  • 656
1
2
3
17 18