Pawan
Pawan

Reputation: 32321

Java : Where exactly the Properties would be configured?

Inside my Java class say Props.java File . I have this static block as shown

static
  {
    instanceName = System.getProperty("bayer.instanceName");
    systemPath = System.getProperty("bayer.home");
    if (systemPath == null)
      systemPath = ".";
    propsFile = new File(System.getProperty("bayer.home") + File.separator + "bayer.properties");
  }

Please tell me where this properties , bayer.instanceName and bayer.home would be defined ?? For more information i am using Apache Tomcat 6.0 server and Linux Environment .

Upvotes: 0

Views: 200

Answers (2)

stacker
stacker

Reputation: 68942

Another standard location is

$TOMCAT_HOME/bin/setenv.sh

If you don't find them there do a grep bayer.home $TOMCAT_HOME/bin

Another resource to check are the init-scripts which depend on your system. See /etc/init.d.

Upvotes: 0

Bohemian
Bohemian

Reputation: 424953

System properties are set on the java command line using the -Dpropertyname=value syntax, for example:

java -cp someclasspath -Dbayer.instanceName=foo com.mycompany.MyClass

See this answer for more info.

Upvotes: 2

Related Questions