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.

239 questions
75
votes
8 answers

How can I specify system properties in Tomcat configuration on startup?

I understand that I can specify system properties to Tomcat by passing arguments with the -D parameter, for example "-Dmy.prop=value". I am wondering if there is a cleaner way of doing this by specifying the property values in the context.xml file…
Markus
  • 1,173
  • 2
  • 14
  • 23
71
votes
5 answers

Set multiple system properties Java command line

Is there an easier way to specify multiple System Properties on the command line to a Java program rather than having multiple -D statements? Trying to avoid this: java -jar -DNAME="myName" -DVERSION="1.0" -DLOCATION="home" program.jar I thought I…
Tyler DeWitt
  • 22,191
  • 36
  • 108
  • 189
65
votes
4 answers

Specify system property to Maven project

Is there a way ( I mean how do I ) set a system property in a maven project? I want to access a property from my test and my webapp ( running locally ) and I know I can use a java system property. Should I put that in ./settings.xml or something…
OscarRyz
  • 184,433
  • 106
  • 369
  • 548
58
votes
5 answers

Driver executable must be set by the webdriver.ie.driver system property

I am using Selenium for automating the tests. My application exclusively uses IE, it will not work on other Browsers. Code: import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.By; import…
vkrams
  • 6,227
  • 17
  • 67
  • 113
49
votes
7 answers

Scope of the Java System Properties

In Java we use System.setProperty() method to set some system properties. According to this article the use of system properties is bit tricky. System.setProperty() can be an evil call. It is 100% thread-hostile It contains super-global…
Chathuranga Chandrasekara
  • 19,150
  • 28
  • 95
  • 135
44
votes
2 answers

What's the difference between a System property and environment variable

I am not clear about this. When I run a java App or run an Applet in applet viewer, (in the IDE environment), System.getProperty("java.class.path") gives me the same as System.getenv("CLASSPATH") which is the CLASSPATH defined in my env…
Khue Vu
  • 3,022
  • 4
  • 35
  • 39
40
votes
3 answers

Set java system properties in IntelliJ or Eclipse

I have a project which runs correctly under the terminal command mvn package exec:java -Dplatform.dependencies -Dexec.mainClass=Demo Now, I need to debug it correctly (not terminal) with IntelliJ or Eclipse on Mac (preferably IntelliJ) but I have…
diegomontoyas
  • 1,405
  • 2
  • 16
  • 21
38
votes
3 answers

Maven 2.1.0 not passing on system properties to Java virtual machine

We use the command line to pass on system properties to the Java virtual machine when running our Hudson builds on a Linux box. It used to work quite well in 2.0.9 by since we upgraded to 2.1.0 it has stopped working altogether. The system…
raisercostin
  • 7,909
  • 3
  • 58
  • 68
37
votes
4 answers

Can I define System Properties within Spring Boot configuration files?

I have a single application.yml configuration file for my Spring Boot app that defines two profiles (as described in the documentation). When the production profile is enabled, I would like to set the http.maxConnections system property to a custom…
bdkosher
  • 5,238
  • 2
  • 29
  • 39
28
votes
2 answers

Change user.home system property

How do I change the user.home system property from outside my java program, so that it thinks it's a different directory from D:\Documents and Settings\%USERNAME%? Via environment variables, or VM arguments?
tekumara
  • 7,571
  • 9
  • 51
  • 65
26
votes
3 answers

How to add new System Properties in java

Is it possible to add new values to Java System Properties. If there is any how can introduce new keys with there corresponding values in Java System Properties.
Nelo Angelo
  • 857
  • 3
  • 11
  • 16
23
votes
9 answers

Crowdsourcing a Complete list of Common Java System Properties and Known Values

I've been inspired by another question: Best Practice for Using Java System Properties I'm currently looking for a complete list of Java system properties and possible values. I'm working on a simple class to simplify use of them (If you're…
sfussenegger
  • 33,373
  • 14
  • 91
  • 117
23
votes
3 answers

If I specify a System property multiple times when invoking JVM which value is used?

If I specify a system property multiple times when invoking the JVM which value will I actually get when I retrieve the property? e.g. java -Dprop=A -Dprop=B -jar my.jar What will be the result when I call System.getProperty("prop");? The Java…
RobV
  • 26,016
  • 10
  • 71
  • 114
21
votes
3 answers

Set System Property for JUnit Runner (Eclipse) to test a Spring Web App

Our web app uses SystemPropertyPlaceholder to load property files depending on the value of a system property (see below) The default setup for running it locally is stored in application.properties. On the production server we currently just set…
Pete
  • 9,930
  • 22
  • 87
  • 134
17
votes
3 answers

Set System propery to Null in Java

In my unit tests I need to set the "workingDir" system property to Null. But I can not do somesing like this, because It give me NullPointerException: System.setProperty("workingDir", null); How can I do it?
Victoria Seniuk
  • 1,215
  • 3
  • 14
  • 22
1
2 3
15 16