How can I pass environment variables to the child process?

How can I pass environment variables to the child process? This is what I tried and it didn't work.
     static public void main (String[] args) throws Exception {
          ProcessBuilder b = new ProcessBuilder("java", "-cp", ".", "Child");
          Map<String, String> map = b.environment();
          map.put("custom.property", "my value");
             b.redirectErrorStream(true);
          Process p = b.start();
          BufferedReader reader = new BufferedReader (new InputStreamReader(p.getInputStream()));
          String line = null;
          while (null != (line = reader.readLine())) {
               System.out.println(line);
     public static void main(String[] args) {
          System.out.println("The value of custom.property is : " + System.getProperty("custom.property"));
     }and the result is:
The value of custom.property is : null

Complete test:
     static public void main (String[] args) throws Exception {
          ProcessBuilder b = new ProcessBuilder("java", "-Dcustom.property=my property value", "-cp", ".", "Child");
          Map<String, String> map = b.environment();
          map.put("custom.property", "my environment value");
             b.redirectErrorStream(true);
          Process p = b.start();
          BufferedReader reader = new BufferedReader (new InputStreamReader(p.getInputStream()));
          String line = null;
          while (null != (line = reader.readLine())) {
               System.out.println(line);
     public static void main(String[] args) {
          System.out.println("Property value of custom.property is : " + System.getProperty("custom.property"));
          System.out.println("Environment value of custom.property is : " + System.getenv("custom.property"));          
     }

Similar Messages

  • How can i pass a variable instead of a table name in the Select statement.

    Dear all
    how can i pass a variable instead of a table name in a select statement ?
    Example :-
    Begin
    P_get_procedure_tname (aap_name,otable_name);--It will take an application name and will return a table name
    Select col1 into ocol1
    from  ---- here i want to pass the variable OTABLE_NAME
    End;How can i pass this ?

    Hi,
    You can use dynamic sql.
    EXECUTE IMMEDIATE 'SELECT COL1 INTO ' || OCOL1 || ' FROM " || OTABLE_NAME;
    {code}
    cheers
    VT                                                                                                                                                                                                                                                                                                   

  • How can I use environment variables in a controller?

    Hi all,
    How can I use environment variables in a controller?
    I want to pass a fully qualified directory and file name to FileInputStream and would like to do it by resolving an env variable, such as $APPLTMP.
    Is there a method somewhere that would resolve this??
    By the way,Did anyone used the class of "oracle.apps.fnd.cp.request.RemoteFile"?
    The following is the code.
    My EBS server is installed with 2 nodes(one for current,and other is for application and DB).I want to copy the current server's file to the application server's $APPLTMP directory. But the result of "mCtx.getEnvStore().getEnv("APPLTMP")" is current server's $APPLTMP directory.
    Can anyone help me on this?
    private String getURL()
    throws IOException
    File locC = null;
    File remC = new File(mPath);
    String lurl = null;
    CpUtil lUtil = new CpUtil();
    String exten;
    Connection lConn = mCtx.getJDBCConnection();
    ErrorStack lES = mCtx.getErrorStack();
    LogFile lLF = mCtx.getLogFile();
    String gwyuid = mCtx.getEnvStore().getEnv("GWYUID");
    String tmpDir = mCtx.getEnvStore().getEnv("APPLTMP");
    String twoTask = mCtx.getEnvStore().getEnv("TWO_TASK");
    // create temp file
    mLPath = lUtil.createTempFile("OF", exten, tmpDir);
    lUtil.logTempFile(mLPath, mLNode, mCtx);
    Thanks,
    binghao

    However within OAF on the application it doesn't.
    what doesnt work, do you get errors or nothing ?XX_TOP is defined in adovars.env only. Anywhere else this has to go?
    No, it is read from the adovars.env file only.Thanks
    Tapash

  • How can I pass a value to the command prompt?

    I was wondering how can I pass a value to the command prompt with Windows and Linux? I'm more interested in Linux's system than Windows though. Is there a way to return info from the command prompt?

    Here is a snippet from http://mindprod.com/jglossexec.html that explains how in detail.
    Runtime.getRuntime().exec("myprog.exe") will spawn an external process that runs in parallel with the Java execution. In Windows 95/98/ME/NT/2000/XP, you must use an explicit *.exe or *.com extension on the parameter. It is also best to fully qualify those names so that the system executable search path is irrelevant, and so you don't pick up some stray program off the path with the same name.
    To run a *.BAT, *.CMD, *.html *.BTM or URL you must invoke the command processor with these as a parameter. These extensions are not first class executables in Windows. They are input data for the command processor. You must also invoke the command processor when you want to use the < > | piping options, Here's how, presuming you are not interested in looking at the output:
    Runtime.getRuntime( ).exec ("command.com /E:1900 /C MyBat.bat" );
    Runtime.getRuntime( ).exec ("cmd.exe /E:1900 /C MyCmd.cmd" );
    Runtime.getRuntime( ).exec ("C:\\4DOS601\\4DOS.COM /E:1900 /C MyBtm.btm" );
    Runtime.getRuntime( ).exec ("D:\\4NT301\\4NT.EXE /E:1900 /C MyBtm.btm" );
    There are also overloaded forms of exec(),
    Runtime.getRuntime( ).exec ("command.com /E:1900 /C MyBat.bat", null);
    Runtime.getRuntime( ).exec ("command.com /E:1900 /C MyBat.bat", null, "C:\\SomeDirectory");
    The second argument can be a String [], and can be used to set environment variables. In the second case, "C:\\SomeDirectory" specifies a directory for the process to start in. If, for instance, your process saves files to disk, then this form allows you to specify which directory they will be saved in.
    Windows and NT will let you feed a URL string to the command processor and it will find a browser, launch the browser, and render the page, e.g.
    Runtime.getRuntime( ).exec ("command.com http://mindprod.com/projects.html" );
    Another lower level approach that does not require extension associations to be quite as well set up is:
    Runtime.getRuntime( ).exec ("rundll32 url.dll,FileProtocolHandler http://mindprod.com/projects.html" );
    Note that a URL is not the same thing as a file name. You can point your browser at a local file with something like this: file://localhost/E:/mindprod/jgloss.html or file:///E|/mindprod/jgloss.html.
    Composing just the right platform-specific command to launch browser and feed it a URL to display can be frustrating. You can use the BrowserLauncher package to do that for you.
    Note that
    rundll32.exe url.dll,FileProtocolHandler file:///E|/mindprod/jgloss.html
    won't work on the command line because | is reserved as the piping operator, though it will work as an exec parameter passed directly to the rundll32.exe executable.
    With explicit extensions and appropriately set up associations in Windows 95/98/ME/NT/2000/XP you can often bypass the command processor and invoke the file directly, even *.bat.
    Similarly, for Unix/Linux you must spawn the program that can process the script, e.g. bash. However, you can run scripts directly with exec if you do two things:
    Start the script with #!bash or whatever the interpreter's name is.
    Mark the script file itself with the executable attribute.
    Alternatively start the script interpreter, e.g.
    Runtime.getRuntime( ).exec (new String[]{"/bin/sh", "-c", "echo $SHELL"}";

  • How can i pass a parameter to the query to filter the result of this lookup

    Hello,
    i'm developping a web application with JDeveloper 10.1.2 and JHeadStart.
    i realy need to know how can i filter the lookup (LOV) query result.
    in other word, when i click on the lookup, it show all the row that exist in may data base table.
    what i want is how can i pass a parameter to the query to filter the result of this lookup ?
    Thank you

    Hi,
    have a look if this helps
    http://oracle.com/technology/products/jdev/tips/fnimphius/restrictlovlist/restrictlov.html
    Frank

  • How can I pass a variable  value from first jsp page to thired jsp page

    In my program ,threr are three jsp pages . I want the first pages's variable value in to thired page .How can I acess.
    I used the request.getparameter() ,but when I print the value , null value is getting .

    request parameters only last for one request.
    To save them longer than that you need to save them somewhere.
    Couple of alternatives
    1 - store them to session
    session.setAttribute("username", request.getParameter("username");
    2 - create a hidden field on page 2 and store the value from page 1 there. When you submit page2, you can get it on page3 with request.getParameter again.
    <input type="hidden" name="username" value="<%= request.getParameter("username") %>">

  • How can I pass a path to the FileReference upload function?

    i don't understand how can i upload a file from the browse
    function after you've selected a file. since FileReference.name
    returns
    only the filename w/extension and not the path, how can i
    work around this?
    i understand the security implications with a swf and the
    such, but what to do? and using an AIR app is not an option for me.
    i have a .net web service in place and it works with a hard
    coded string, such as in the snippet below, but how are people
    doing this by using the browse method as oppossed to a static
    string?
    i get an IO error with just the browse() returned filename,
    which makes sense when you think about it. path, path, path...ARGH!
    thanks folks...
    -fd

    i don't understand how can i upload a file from the browse
    function after you've selected a file. since FileReference.name
    returns
    only the filename w/extension and not the path, how can i
    work around this?
    i understand the security implications with a swf and the
    such, but what to do? and using an AIR app is not an option for me.
    i have a .net web service in place and it works with a hard
    coded string, such as in the snippet below, but how are people
    doing this by using the browse method as oppossed to a static
    string?
    i get an IO error with just the browse() returned filename,
    which makes sense when you think about it. path, path, path...ARGH!
    thanks folks...
    -fd

  • How can I pass a variable to an applet in JSP?

    I want to invoke an Applet in JSP and pass a variable( ie. port) to the Applet. I do as follows:
    <applet code="best.Applet1.class" width=400 height=300 >
    <param name=port1 value=port>
    </applet>
    in Applet1.java , I use getParameter("port1"),yet I got character string "port" ,not the value of port(i.e. 100).
    How can I get 100 not "port"? Thanks!!!

    Assuming that port is a variable defined and initailized in the jsp:
    <applet code="best.Applet1.class" width=400 height=300 >
    <param name=port1 value=<%= port %>>
    </applet>

  • How can i pass a variable's value from PR to PFR

    Dear all,
    hope you are fine.
    i would like to pass a variable's value from PR to PFR.
    how can i do that.
    please suggest.
    in PR:
    String transactionId = (String) vo_trans.first().getAttribute("Getnexttrans");
    i would like to get this value to PFR.

    Mofizur,
    You can achieve the same using Session variable.
    If u are not executing the VO after PR. Then you will be able to get the same value as u are using in PR
    String transactionId = (String) vo_trans.first().getAttribute("Getnexttrans");
    Note - You have a few of the threads left open, mark it as answered if solved.
    Regards,
    Gyan

  • CAN I PASS FORM VARIABLES TO THE DATABASE PROCEDURE IN PERSONALIZATION

    When I try to use form variable in the database procedure call from personalization I get the attached error.
    Under forms personalization
    From Actions tab --> builtin --> Execute Procedure when I call a database procedure and pass one of the form variable as parameter I get "ora-01008 couldn't be validate" error
    Can we pass on form variables to the database package using personalization ? If yes, then is this the right way?
    Message was edited by:
    omitchel

    I tried customizing the Quoting Form, it works.
    What you have done is correct, but this is how you call it
    ='begin
    db_proc('''||${item.qothddet_main.quote_name.value}||''');
    end'
    here
    qothddet_main : block name
    quote_name : item name
    Thanks
    Tapash

  • How can I reading environment variables (user variables)

    Hi,
    I hope someone can halp me out:
    In the software that I develop it is neccessary to read some user (environment) variables, such as the temp folder of the current user.
    I know that I can read out some system variables like this:
    String homePath = System.getProperty("user.home");
    But how can I read out some other variables, especially the temp folder of the current user?
    Thanks

    I might have misunderstood you, but I am notlooking
    for the PATH variable. I need the location of
    the
    temp folder of the current user. This should be
    called TEMP or so, but this does not work.Can you deduce from the link he provided, to lookat
    System.getenv(), and find the "TEMP" environment
    variable in what it returns to you?That said, I believe the "temp" folder may be
    provided in one of the normal System properties
    anyway, so you probably don't need to go that route.
    Print all your System.getProperties() values, and see
    if it's in there.Yepp. os.io.temp or something.

  • How can I pass a variable(s) between two swfs?

    Hello all,
    I was wondering if it is possible to pass variables between
    two standalone swfs that are not being hosted on a webserver.
    I am creating a flash projector to go on a CD Rom and want to
    load another swf into the _root level and in the process, want to
    pass a variable or two to the "new" swf that is being loaded. Any
    help or insights that you can offer would be greatly appreciated!
    Thanks for your help.
    Tim

    if by _root level you mean you're loading something into
    _level0 you can't won't be able to use the localconnection. the
    sharedobject is your only option.

  • How can I pass a variable between JSP and Role Form

    I need to pass a variable from (a copy of) applicationmodify.jsp to the IDM Role Form so that the variable is available within the Role Form at display. We've tried getAttribute and setAttribute modifying both the Role Form and the applicationmodify JSP and can get the form to the role form but not accessible but have had no other success. Has anyone had any success in doing this? Any suggestions would be appreciated.

    if by _root level you mean you're loading something into
    _level0 you can't won't be able to use the localconnection. the
    sharedobject is your only option.

  • How can I pass Global Variable from Page1 to Page2

    I have the following senario.
    Pag1 - report is based on following PL\SQL
    declare
    g1 varchar2(100);
    begin
    g1 = select * from emp where dept = 10;
    return g1;
    end;
    Now I have Page2 - based on following PL\SQL
    declare
    g2 varchar2(100);
    begin
    g2 := g1; -- here i want to use variable g1???
    return g2;
    end;
    My question is - How can I use variable g1 from P1 in my new page P2.
    Thanks,
    Deepak

    Hi Andy,
    Thanks for the clarification.
    I did exactly the same, created a new Region with HTML (PL\SQL) and got the output. it was fine.
    Now when I am using exactly the same code in a Report (PL/SQL function returning a SQL Query), I am getting the following error.
    DECLARE
    g VARCHAR2(100);
    BEGIN
    g := 'This is a test string';
    APEX_UTIL.SET_SESSION_STATE('G_SQL_STRING', g);
    htp.p(v('G_SQL_STRING'));
    END;
    ERR-1002 Unable to find item ID for item "FLOW_SECURITY_GROUP_ID" in application "4000".
    ERR-1002 Unable to find item ID for item "G_SQL_STRING" in application "4000".
    I am doing the same thing, nothing changed....only difference is in 1st case I am using HTML (PL\SQL) Region and in 2nd case using the REPORT Region (PL/SQL function returning a SQL Query)
    thanks,
    deepak

  • How can I pass a variable to a form to pre-fill form fields on load?

    Hi all,
    I am developing a Windows Form Applicaiton in C# to register new users and walk them through a signup process.The application does a lot of other things as well. This part of it collects their personal information and saves the data to the database. Part of the process requires the user to complete a pdf form (W-4 tax form). I would like to pre-populate as many form fields as possible for them when the pdf launches, and not have them enter anything to get their data to prefill the form fields.
    My issue is I can't figure out how to get the pdf to know who is loading the form so I can do the SQL select and populate the form fields. I need to do a select * from Table where UniqueID="xxxxx" but how can I get the form to know on load what "xxxxx" is so it grabs the users personal info from the database?
    I have searched high and low and found nothing on how to do this without doing some hoakey hack outside of the application or pdf doc.
    I am creating/editing the form in LiveCycle Designer 8 and am loading the form for use by the user in acrobat 9.
    Any help,ideas, or nudging in the right direction would be much appreciated!

    I found this solution:
    REPORT YRT_TEST4.
    data: r_range type range of matnr.
    perform test changing r_range.
    *& Form test
    form test changing p_r_range like r_range.
    endform. " test
    REgards,
    Ravi

Maybe you are looking for

  • Why is it not possible to access lightroom catalouge trough a Network (ready nas)

    As the Topic title says why i can´t use My LRM Catalouge when it´s hosted on my Network hard drive or why I can´t create a catalouge an an Network Share (ready Nas) With friendly Regards Colin

  • (updating xml value)adding an element in an xml type column

    Hi all, i hava a table that contains an xml-Type column (non schema based) i have inserted some data in it table:(id,xmlcolumn) ex: insert into t1 values(1,'<Chapters> <Chapter>ch1<Chapter> <Chapter>ch2<Chapter> </Chapters>') i need to add a new Chap

  • Need to send text string to new row in expandable table

    I have a table that is a summary of other choices made throughout the document.  For specific check boxes in the form, there is a defined phrase that needs to be sent to a new row in the summary table. The general idea is that for checkbox: form1.sfM

  • Any suggestions about this program to improve performance and effective cod

    CREATE OR REPLACE PACKAGE SEODS02.ODS_ACCOUNT AS Package Name : ODS_ACCOUNT /* Description : This procedure will be called to move the data from */ /* ACCT_ALT_ID_STG (staging) table to ACCT_ALT_ID table and EODS_ACCT */ /* table for all new accounts

  • Bad Bind Variable Problem

    Hi I am trying to create a trigger and facing Bad Bind Variable problem. Plz let me know, what's the problem in this trigger. CREATE OR REPLACE TRIGGER Tender_tax_update AFTER INSERT OR UPDATE OR DELETE OF ITEM_QTY,ITEM_RATE,TENDER_ACC_QTY ON TENDER_