0

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 .

Pawan
  • 31,545
  • 102
  • 256
  • 434
  • Is this a duplicate of that one? http://stackoverflow.com/questions/8445488/how-to-find-out-where-the-property-name-defined-inside-linux-machiene – home Dec 09 '11 at 13:20

2 Answers2

2

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.

Community
  • 1
  • 1
Bohemian
  • 412,405
  • 93
  • 575
  • 722
  • I think `java -cp someclasspath -Dbayer.instanceName=foo com.mycompany.MyClass ` is correct. In your case `-Dbayer.instanceName=foo` will be considered as first system argument – korifey Dec 09 '11 at 11:42
  • Hi , from the link I found out this useful , Environment variables are set in the OS, eg in linux export HOME=/Users/myusername or on windows SET WINDIR=C:\Windows etc. But how can i see the properties file ?? – Pawan Dec 09 '11 at 11:47
  • @yyyi777 Your application must actively *load* a properties file - it's not automatic. Check the code to find out which files are being loaded – Bohemian Dec 09 '11 at 11:51
0

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.

stacker
  • 68,052
  • 28
  • 140
  • 210