0

My project has a jar in classpath with some utilities in it. When I run the program using ant on Red Hat linux, it's unable to read the system properties using System.getProperty(key), but it works perfectly fine when ran on Ubuntu.

Any suggestion to why this might be happening is appreciated.

ant target

<target name="test">
    <property environment="env"/>
    <echo message="PATH_ROOT set  =>  ${env.PATH_ROOT}" />
    <echo message="CUSTOM_REPORT_PATH set  =>  ${env.CUSTOM_REPORT_PATH}" />
    <testng classpathref="compile.classpath" haltOnfailure="false" outputDir="${testng.output.dir}/xxx">
        <sysproperty key="PATH_ROOT" value="${env.PATH_ROOT}"/>
        <sysproperty key="CUSTOM_REPORT_PATH" value="${env.CUSTOM_REPORT_PATH}"/>
        <xmlfileset dir="src/com/xxx" includes="suite.xml" />
    </testng>
</target>

================

Max
  • 1,202
  • 1
  • 13
  • 21
  • 1
    It should work, can you post some code of ant script and/or Java code ? How are you setting the property that you try to get from Java code ? – Roberto Apr 17 '14 at 08:24
  • Define 'unable'. What happens instead? AccessControlException for example? – user207421 Apr 17 '14 at 09:56
  • Roberto I'm using export command to setup the env variables and then ant reads them and sets system variables for java program to read. The variables which are read in the direct program invoked by ant work fine however the the variables read in code which is inside a jar in classapth doesn't work on red hat. ======================== – Max Apr 17 '14 at 11:37
  • Have added the ant target above – Max Apr 17 '14 at 11:43

1 Answers1

0

Guys it was a silly mistake. The framework was not executing the file which had the statements to fetch system variables as the listener was missing in testng suite which is a must for testng to invoke that

Max
  • 1,202
  • 1
  • 13
  • 21