Adding environment variable in build.xml(ANT)

Hi,
I need some information Regarding ANT,
the problem is i have to add a property file in build.xml (as a environment varialble) so that i can read it in my java code. as
System.getProperty("").
Please sugggest me how to set environment variable in build.xml(ANT)
Thanks
Edited by: fdfddf on Apr 7, 2008 3:20 PM

Hi Jakain, yep thanks for your information but my manager wants that way to do..
he wanted me to set property file as a environment file using build.xml as this property file changes dynamically..
can you suggest me

Similar Messages

  • Problem with compiling build.xml ( ANT tools)  in Eclipse

    I was trying to compile my project thru ANT within eclipse...and it gave me error:
    Cannot use classic compiler, as it is not available A common solution is to set the environment variable JAVA_HOME to your jdk directory.
         at org.apache.tools.ant.taskdefs.compilers.Javac12.execute(Javac12.java:96)
         at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:557)
         at org.apache.tools.ant.Task.perform(Task.java:217)
         at org.apache.tools.ant.Target.execute(Target.java:184)
         at org.apache.tools.ant.Target.performTasks(Target.java:202)
         at org.apache.tools.ant.Project.executeTarget(Project.java:601)
         at org.apache.tools.ant.Project.executeTargets(Project.java:560)
         at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:262)
         at java.lang.reflect.Method.invoke(Native Method)
         at org.eclipse.ant.core.AntRunner.run(AntRunner.java:233)
         at org.eclipse.ui.externaltools.internal.core.AntFileRunner.execute(AntFileRunner.java:59)
         at org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.executeRunner(DefaultRunnerContext.java:413)
         at org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.run(DefaultRunnerContext.java:464)
         at org.eclipse.ui.externaltools.internal.ui.AntLaunchWizard$1.run(AntLaunchWizard.java:117)
         at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:98)
    Build exception: E:\MyPrograms\ejb\MEJB\Hello\build.xml:33: Cannot use classic compiler, as it is not available A common solution is to set the environment variable JAVA_HOME to your jdk directory.
    I already set my JAVA_HOME with jdk1.3.1, but end up with the same error. JRE 1.3.1_07 is installed on my machine and my project contains the installed jre. It appears in both Project properties dialog box and in Installed JRE tab JAVA BUILD PATH of preferences...
    my ANT compilation works fine with command line.
    Please Help !!

    have you did some wrong with the build output path?
    i am dont understand clearful.but i am think so ;
    example :
    the eclipse's default build out path is 'bin',
    so,if you compile by this code:
    <target name="compile">
    <mkdir dir="./class" />
    <javac srcdir="./src" destdir="./class"
    classpath="com.Ostermiller.util.*"
    encoding="${ENCODING}"
    debug="on" optimize="off" deprecation="off" />
    </target>
    * the "ENCODING" 's value is setting in the properties file.
    you will maybe get the 'Cannot use classic compiler' error only.
    you can change the build output path ,or use the default path ;
    I am sorry ,
    I was limited in English and was a bigginer of java ,
    so that i cant to talk Clearly.
    if it cant working fine ,please mail to me :[email protected]
    good luck!
    Kou.huang

  • How to use environment variables in extension.xml

    Is it possible to use environment variable when specify classpath in extension.xml that is part of one JDev extension?

    Hi Matias,
    Sure, you can use substitute-variables command for this purpose.
    See the example below:
    concat [substitute-variables "${system_property:user.home}" | str] "/.m2/repository"]
    Kind regards,
    Ulyana.

  • Adding environment variables to Runtime.exec()

    Hello,
    I'm trying to use Runtime.getRuntime().exec(command, envp);
    When envp is null the program launches properly. (the doc says that the subprocess inherits the environment settings of the current process).
    I want to add an environment variable, so when I use an array containing only my variable (envp), the process fails. I guess it needs the variables of the current process (as used when using null).
    In that case, How adding a variable instead of replacing the default ??????
    (I did not see any way to retrieve these default variables so I can concatenate with the custom one)
    Thanks !

    Use a wrapper script that is launched with a default environment and first sets the custom variable and goes on with your program.

  • How to modify build.xml ant to invoke a static init method when building?

    Hello,
    I´d like to make it as such that when I select to build and clean project in netbeans it calls a specific static init method in one of the project classes (which actually generates the database file). //for that purpose that code is only needed there. Is it possible?

    hi.. please help me with this problem...
    i need to execute tomcat server using my ant build file... but how can i do that if the tomcat server is located in other PC... i tried the exec task, but it seems to be not enough... the server doesn't run on the other pc but my it seems fine on my console.
    by the way, here's my code...
    <target name="run_tomcat">
    <exec dir="${src.dir}" executable="cmd">
    <arg line="/c startup.bat" />
    </exec>
    <echo message="tomcat successfully running!!!"/>
    </target>
    my src.dir has value in the properties file which contains the mapped directory. please tell me.. is it really possible to run a program in other PC using my build file in my PC...
    please....please....please....please.... heeeelllpppp!!!!
    tnx a lot!!!!

  • Adding Environment Variables in X11

    Could anyone please tell me how can I do it?

    See, for example,
    http://developer.apple.com/qa/qa2001/qa1067.html
    http://www.astro.washington.edu/owen/AquaEnvVar.html
    HTH

  • Running Ant file - build.xml from JDev

    hi all
    I have created simple BPEL project. I'm using JDev 10.1.3.1.0
    & SOA suite 10.1.3.1.0 . If I deploy my BPEL process using deployment utility
    of JDev then it gets deployed well on localhost:8888 .
    But If I run build.xml Ant file from JDev then it complies properly but it tries to deploy on[b] localhost:9700. If I run same Ant file from Developer prompt then it again BPEL gets deployed properly on localhost:8888.
    It means JDev is overwriting some properties values.
    Does any one aware of this.?
    thanks
    /patel

    Hi Patel,
    Have a look here:
    http://www.it-eye.nl/weblog/2007/02/16/customizing-bpel-process-deployement-with-ant-165-in-jdeveloper/
    Maybe it will helpp you out!
    Regards,
    Tom

  • How to add javah command in build.xml?

    Hello
    I need to add my javah command to "MyProjet"/build/build.xml (ant).
    How can I do it?
    any reference/example?
    Thanks
    U.

    Try looking here.

  • Help with flex4unit ant build.xml: Socket timeout waiting for flexunit report

    I'm having trouble setting up ant to build and test my project locally and I'm not sure what the next step is.
    Info:
    Running on XP/Cygwin.
    All of the files that FlexUnit4 references when used in Flash Builder are in my '${basename}/libs' folder (eg FlexUnit4_1.0.swc).
    I've placed the flexunit4 task in my ant/libs folder.
    I'm getting two errors...
    I don't think I've set up the 'socket' stuff right for the tests. It just sits and waits then dies...
    [flexunit] Waiting for client connection ...
    (about a minute later)
    [flexunit] Stopping server ...
    [flexunit] End of test data reached, sending acknowledgement to player ...
    [flexunit] Closing client connection ...
    [flexunit] Closing server on port [1024] ...
    BUILD FAILED
    java.util.concurrent.ExecutionException: Socket timeout waiting for flexunit report
    Plus this is the error I get from the flash player:
    ReferenceError: Error #1065: Variable mx.skins.spark::BorderSkin is not defined.
    I don't know why it's complaining about Borderskin as I think I have included all the flex4 libs I could find. I suspect this second error is causing the first error?
    Any help appreciated. I think I'm just setting it up all wrong.
    Screencap of errors:
    http://twitpic.com/l7ay8
    build.xml:
    http://gist.github.com/20804

    Finally got everything working using the files from the CI Example which what i probably should have done in the first place.
    So a rough guide for anyone just starting out with this:
    Download the Flex 4 'workspace' from the digital primates hudson server . This appears to contain flexunit library and examples in various stages of development.
    I used Flex Builder 4 Beta 2 to set up my Test Suite and Test Cases.
    I then loaded the libs folder from:
    workspace.zip\workspace\project\FlexUnit4SampleCIProject
    into my flex project's libs folder:
    this includes:
    FlexUnit4.swc
    FlexUnit4CIListener.swc
    flexUnit4UIRunner.swc
    flexTasks.jar
    flexUnitTasks.jar
    I didn't need to remove the FlexUnit4 stuff that is 'referenced' automatically by flash builder when you start adding flexunit4 tests/suites.
    Then I used a modified version of the TestRunner.mxml found in:
    workspace.zip\workspace\project\FlexUnit4SampleCIProject\src\test\flex
    The lines to pay attention to are the ones that look like:
    static public function currentRunTestSuite():Array {
        var testsToRun:Array = new Array();
        testsToRun.push(packagename.TestSuiteName);
        testsToRun.push(packagename.TestClassName);
        return testsToRun;
    Just make sure you update this list to include all of the test suites &/or individual tests you want to run.
    I made this a static function and modified the code in the "FlexUnitApplication.mxml" file to use this function so i'd only need to update one list of suites/tests.
    FlexUnitApplication.mxml is generated automatically when you run FlexUnit4 tests in the Flash Builder 4 Beta 2 IDE.
    This is the build.xml file I'm using in the project:
    http://gist.github.com/208211
    Change the name of the project from "Flare" to whatever and adjust the other path settings where required (though you might want to write this from scratch at least once so you understand roughly what is going on).
    The Debug Flash Player must be installed on the server otherwise you'll get a:
    java.util.concurrent.ExecutionException: Socket timeout waiting for flexunit report
    ...while it waits for the non-existant debugger to attach. (This is obvious but I did forget and was a bit bewildered for a moment)
    Need to also ensure the environment variable:FLEX_HOME is set to the location you installed the flex sdk...by editing your .bashrc setting the environment variable the in the Hudson Configuration.
    You'll need to point Hudson at your ant installation and your jdk installation. If you downloaded he sdk, be aware you might need to point it to the jdk folder inside the place you installed the sdk.
    And I think that's all the problems I had. Hope it's useful to someone... if anyone who actually knows what they are doing can point out any potential issues/better ways of doing things, feel free to comment.
    Thanks to Brian (legrosb) and Mike (mlabriola) for their assistance!

  • Errror while Running the ant file(build.xml) when applying B2B-BPEL patch

    Hello all,
    I am trying to apply the B2B WSIL Browser patch and while running the ant file i got the following warning while backing out d3l.jar file
    echo Backing out dl3l.jar to avoid conflicts with B2B...
    move *Warning: Could not find file C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL\${env.ORACLE_HOME}\xqs\lib\d3l.jar to copy.*
    and the following error when it was not able to find admin_client.jar file
    *java Unable to access jarfile C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL\${env.ORACLE_HOME}\j2ee\home\admin_client.jar*
    java Java Result: 1
    echo Binding B2B WSIL Browser...
    *java Unable to access jarfile C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL\${env.ORACLE_HOME}\j2ee\home\admin_client.jar*
    and the BUILD FAILED
    *so i created the necessary folders in the newly generated folder manually in ${env.ORACLE_HOME} i.e xqs\lib & j2ee\home and pasted the d3l.jar and admin_client.jar in these folders respectively,and again ran the ant file,this time the error is first problem is cleared i.e it is not showing the warning that it could not find* d3l.jar_+ file and it is also converting this file as d3l.jar.hide_+ *, but this time in the place of second error a new error is generated i.e* +
    Problem_
    C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL&gt;ant
    Buildfile: build.xml
    apply-b2b-bpel-10.1.3:
    echo Prompting for B2B repository connection parameters...
    input Please enter B2B repository hostname [http://127.0.0.1:] [http://127.0.0.1]
    172.17.4.14
    input Please enter B2B repository port 1521: 1521
    1521
    input Please enter B2B repository sid ORCL: ORCL
    orcl
    input Please enter B2B password b2b: b2b
    b2b
    input Please enter oc4j instance name home: home
    home
    input Please enter oc4j admin password welcome1: welcome1
    welcome1
    input Please enter opmn request port 6003: 6003
    6003
    echo Copying b2b.jar and tip.properties to appropriate locations...
    copy Copying 1 file to C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL\${env.ORACLE_HOME}\lib
    copy Copying 1 file to C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL\${env.OB_HOME}\system\classes
    echo Backing out dl3l.jar to avoid conflicts with B2B...
    move Moving 1 file to C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL\${env.ORACLE_HOME}\xqs\lib
    echo Deploying B2B WSIL Browser ...
    echo OPMN Port is : 6003
    echo Container is : home
    echo Host is : ${env.HOSTNAME}
    echo iasadminpassword is : welcome1
    java java.lang.NoClassDefFoundError: oracle/oc4j/admin/deploy/cmdline/Oc4jAdminCmdline
    java Exception in thread "main"
    java Java Result: 1
    echo Binding B2B WSIL Browser...
    java java.lang.NoClassDefFoundError: oracle/oc4j/admin/deploy/cmdline/Oc4jAdminCmdline
    java Exception in thread "main"
    BUILD FAILED
    C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL\build.xml:88: The following error occurred while executing this line:
    C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL\build.xml:49: Java returned: 1
    Total time: 31 seconds
    C:\product\1013~1.1\ORACLE~1\bpel\samples\tmp\B2B-BPEL&gt;
    i have set the classpath for the jdk and jre files correctly and also checked it with a sample program and the file is compiling and running with correct output.then why is it showing up java.lang.NoClassDefFoundError exception.Did anyone face the same problem or have a solution for this problem if they have then plzzz help me
    thnx
    Sunny
    Edited by: sunny kay on Jan 27, 2009 4:14 AM

    Hello sri,
    Thanks for your response as you have told i have set the ORACLE_HOME = C:\product\10.1.3.1\OracleAS_1
    and added C:\product\10.1.3.1\OracleAS_1\bin to my sys path
    and i have also set the JAVA_HOME=C:\product\10.1.3.1\OracleAS_1\jdk
    and added C:\product\10.1.3.1\OracleAS_1\jdk\bin to my sys path
    and ran the patch,now its coming up with a different problem after entering the B2B repository connection parameters...
    and it is
    Problem_
    echo Deploying B2B WSIL Browser ...
    echo OPMN Port is : 6003
    echo Container is : home
    echo Host is : ${env.HOSTNAME}
    echo iasadminpassword is : welcome1
    java
    java
    java Failed at "Could not get DeploymentManager".
    java
    java This is typically the result of an invalid deployer URI format being
    supplied, the target server not being in a started state or incorrect authentic
    ation details being supplied.
    java
    java More information is available by enabling logging -- please see the
    Oracle Containers for J2EE Configuration and Administration Guide for details.
    java
    java
    java Java Result: 1
    echo Binding B2B WSIL Browser...
    java
    java
    java Failed at "Could not get DeploymentManager".
    java
    java This is typically the result of an invalid deployer URI format being
    supplied, the target server not being in a started state or incorrect authentic
    ation details being supplied.
    java
    java More information is available by enabling logging -- please see the
    Oracle Containers for J2EE Configuration and Administration Guide for details.
    java
    java
    BUILD FAILED
    The Application Server is in the started state and these are the details that i have entered when B2B Repository Connection Parameters is prompeted
    echo Prompting for B2B repository connection parameters...
    input Please enter B2B repository hostname [http://127.0.0.1]: [http://127.0.0.1]
    172.17.4.14
    input Please enter B2B repository port [1521|http://forums.oracle.com/forums/]: [1521|http://forums.oracle.com/forums/]
    1521
    input Please enter B2B repository sid ORCL: ORCL
    orcl
    input Please enter B2B password [b2b|http://forums.oracle.com/forums/]: [b2b|http://forums.oracle.com/forums/]
    b2b
    input Please enter oc4j instance name home: home
    home
    input Please enter oc4j admin password [welcome1|http://forums.oracle.com/forums/]: [welcome1|http://forums.oracle.com/forums/]
    welcome1
    input Please enter opmn request port [6003|http://forums.oracle.com/forums/]: [6003|http://forums.oracle.com/forums/]
    6003
    is anything wrong in this i have tried by giving the default host name instead of mine but result is still the same.what is the problem can you figure it out and provide me a solution.
    thnx
    Sunny

  • JDeveloper build vs ant-sca-compile.xml

    Hi everyone,
    I have a composite containing a Spring component. The component can be compiled and deployed in JDeveloper and works fine. However, when I try to compile the composite with ant-sca-compile.xml Ant script (from my JDeveloper - Build JDEVADF_11.1.1.6.0_GENERIC_111205.1733.6192.1) for automated testing the build fails on
    Source port type for "MyTestService" does not match target port type for "MyTestSpring"
    Any idea how to fix it? The Spring component (its inteface) is generated from the published WSDL and seems it is the cause of the problem as composites without Spring can be compiled with that script.
    Thanks,
    Jan

    Hi Manish,
    Compilation of Requester and Provider ABCS takes longer time than other AIA components.So check the Xms and Xmx values in ant-sca-compile.xml and check whether it is matching with your OS environment or try setting at a higher value and then try deploying again.
    Is it building properly or is getting stuck at build level only?
    If its issue with deployment then check $FM_HOME/user_projects/domains/[domain_name]/servers/soa_server1/logs/soa-server1-diagnostic.log.
    Rgds,
    Mandrita.

  • Issues with Indirect xml configuration using environment variable

    My package is not retrieving the the connection strings from the xml file setup through indirect configuration. It is using the connection string directly from the connection manager in the package. Steps below,
    Package-1 has Connection Manager with server : dev, database: Test
    Setup indirect xml configuration : XML file contains the connection string. Environment variable contains the path to the xml.
    Build and deploy on different server (prod).
    Create the same environment variable in prod server.
    Change conenction string in xml file.
    Run the package: package tries to connect to dev instead of prod.
    Change the connection string in the connection manager directly in the package. Build and deploy. Works now - connects to prod as expected.
    For some reason my package is not reading from the xml file.
    Anonymous

    You posted on this issue before and now again, why?
    The "It is using the connection string directly from the connection manager in the package" means the package fails to configure from the conn string in the env. variable.
    You may see it as a warning in the log if you have one enabled.
    The env variable should have the path to the config file, the config file should be parametrized to get the connection to it via the variable, this is the proper scenario.
    Arthur My Blog

  • Environment variable JAVA_HOME and ANT

    Hi,
    I have one parent parent.xml ant file that calls another build.xml files (task <ant>). Each build.xml file uses <javac> but needs to compile with another java version: 1.4 and 5 (defualt in system is JAVA_HOME=java1.4)
    I tried this command:
    <property environment="env"/>
    <ant antfile="build.xml" dir="${my_dir}" target="compile.debug">
      <property name="env.JAVA_HOME" value="c:\jdk1.5.0_05"/>
    </ant>But it seem it doesn't work. The compilation of project in ${my_dir} directory fails because of using 1.4 java compiler.
    Has anybody any idea, plz?

    how about j2ee.bat?

  • How do I use Embed with an environment variable in an Actionscript AIR project Flash Builder 4.7

    I am using Flash Builder 4.7 to build an Actionscript AIR project.  The project embeds a number of png files from my local directory and I have been using absolute paths which all works fine.
    I have a laptop with which I want to start developing the same project - I set up a git repository that both the laptop and main pc can pull from and so I can get the source where I need it and push it back to the central repository.
    My problem is that the absolute paths for the embed commands don't work on the laptop as it has a different filesystem setup (Windows 8 with one drive as opposed to Windows 7 with a SSD and a data drive).  I thought the solution would be as easy as using an environment variable to specify the path which could then point to a different physical directory on both machines, i.e:
    [Embed(source = "DEVELOPER_RESOURCES/graphics/are/here.png"]
    I did a bit of research and there was quite a lot mentioned about setting up resource directories using path variables which I worked through but I just can't get it to compile.  The Actionscript compiler just won't find the png files however I specify the path.  I tried something with a FLEX project and the compiler didn't complain but I think this is because the compiler for FLEX uses a different convention.
    [Embed(source ="/Project Name/DEVELOPER_RESOURCES/graphics/are/here.png"]  works with FLEX but not Actionscript.
    So does anyone have a recipe for using the Embed command referencing assets using an environment variable that works across multiple machines with different file structures?

    I managed to find a solution on Windows which was to use symlinks and absolute paths.  You an basically point one directory to another so I did something like:
    mklink c:\developer_resources c:/the/local/path/to/my/resources
    and then reference all resources as c:\developer_resources\...
    Now as long as a developer machine has the right link (from c:\developer_resources to the place where the resources are kept) then it seems to work. 
    This doesn't however work for Mac and certainly isn't a solution for passing files between Mac and windows

  • How do you set NLS_LANG environment variable in report builder

    How do you set up the reports builder environment to display foreign fonts.
    So far what I read makes me think that in report builder I have to set the NLS_LANG environment variable .
    If anyone has done this is that true and if so how.
    Also the languages I want to use are the following.
    Armenian
    Cambodian
    Chinese
    Russian
    Tagalog
    Vietnamese
    How do I find the NLS_LANG environment variables for these.
    Where I am at now+
    I have to set the DEVELOPER NLS LANG. I see the NLS LANG in the registry and I guess I have to add the DEVELOPER NLS LANG.
    Now I am searching for syntax. If anyone knows the syntax for those languages please let me know and how do I set more than 1 at a time.
    Howard
    Edited by: csphard on Apr 14, 2010 5:17 PM
    Edited by: csphard on Apr 14, 2010 5:22 PM
    Edited by: csphard on Apr 15, 2010 9:02 AM

    Hello Howard,
    Check out the following link here you can find your desired NLS parameters.
    http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm
    And about the NLS_LANG for developer why you want to create for developer. Its is already there in REGISTRY. Just seaching in developer registry you can find there.
    how do I set more than 1 at a time.
    You can set only one NLS_LANG parameter at a time.
    -Ammad
    Edited by: Ammad Ahmed on Apr 15, 2010 8:52 PM

Maybe you are looking for