How to add environment variable programmatically??

Hi all,
I want to add TOMCAT_HOME environment variable programmatically. How can I do this?
Is there any dos command to set an environment persistently?
Pls help guys...
Thanks in advance
Mithunk

The way environmental variables work is that they are passed to newly created tasks by the task that creates them. So, for example, when a command shell calls Java it passes a copy if it's current environmental variables, and if Java calls Runtime.exec it can override the set it passes on.
The comands within a shell that set environmental variables can do so because they are part of the command shell, not separate programs run by it.
In short a program run by a shell can't alter the environmental variables belonging to the shell. They move only from the calling task to the called.

Similar Messages

  • Add environment variables to root user

    How do I add environment variables, so they are available to the sudo command?
    I need it to correct the known ruby/rails flaw, that you loose some setup, when updating rubygems.
    I know I need to set:
    +export GEM_HOME="/Library/Ruby/Gems/1.8"+
    +export GEM_PATH="/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/g ems/1.8"+
    but adding those variables to .bashrc, or .bash_profile doesn't make them available for sudo, and so the command
    +sudo gem update+
    actually fails. (only 'gem update' works though)
    Practically I don't need the sudo anyway, since the Ruby directories are not only root writeable, but I want to repair the state of my rubygems installation to the way it was befor doing the rubygems system update.
    Can someone tell me, where I could add environment variables to the sudo environment?

    Which shell are you using?
    If you're using /bin/sh you have to do:
    cdate=$(date +%m/%d)
    export cdate
    You cannot set and export variable in the same command.
    -R

  • How to add (multiple) cursors programmatically in an XY graph?

     how to add (multiple) cursors programmatically in an XY graph?
    I am building an XY graph. then I would like to add cursors at certain locations (positioned on x axis) I determine through a program.
    How can I add cursors programatically?
    Thank you.

    Initialize a cluster array (CrsrList type) with as many cursors as you think you would ever need.   Setup your cursors dynamically, then delete the unused cursors (array elements) and then update your CursorList property.
    Message Edited by vt92 on 03-20-2009 04:04 PM
    "There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
    Attachments:
    cursors.PNG ‏5 KB

  • Webdynpro - how to add global variables and common proj to existing proj

    How to add global variable in either ViewController or CustomController.  We realise that codes must be added within the begin and end exction.  Codes outside that will be deleted when saved. 
    How can we add a common WDP project to an existing project?  We have actually added a common wdp project at the project references screen.  But during runtime, we encouter error.  The error is classNotFoundException.  The class is the class created in the common project.

    Hi.
    I think you need to assign ProB to ProA.
    Step1.
    Open propety of ProjectA.
    Step2.
    Select WebDynproRefrences
    Step3.
    Select Sharing references
    Step4.
    Choose add button.
    Step5.
    If your projectA named "testapp" and you are not using
    DC "local/testapp" is the proper name.
    I hope that it work!!!.

  • How to set environment variables in WL ?

    Hi,
    How to set environment variables in WL ?
    Thanks,
    Srivi

    Hi,
    You can set the environmet variable in Weblogic by using the below commands
    setWLSEnv.cmd/sh ==>Set the CLASSPATH to include the WebLogic Server classes.
    Overview of WebLogic Server Domains
    or you can use to set the Environment variable along with domain specific varables using the SetDomainEnv.cmd
    To run SetDomainEnv.sh in Linux please use
    . ./setDomainEnv.sh it require two dots (Dont miss it )
    http://docs.oracle.com/cd/E28280_01/web.1111/e13749/weblogicserver.htm#ADMRF205
    Hope it helps

  • How to set environment variable ORACLE_HOME ?

    Hi
    I trying to install SAP Solution manager 4.0 SR3:
    OS: Linux RHEL4u4
    DB: Oracle
    SAPinst now stops the installation.
    To proceed with the installation, install the Oracle database as follows:
    1.Log in as user orassm.
    2.Set the DISPLAY variable.
    3.Change to directory /oracle/stage/102_32/database/SAP.
    4.Start './RUNINSTALLER'.
    After you installed the Oracle database software, proceed with the database instance
    installation by choosing 'OK' in this dialog box.
    ./RUNINSTALLER
    oracle_stage is not set (OK)
    oracle_base is not set (OK)
    oracle_home is not set (OK)
    oracle_sid is not set (OK)
    oracle_home_name is not set (OK)
    oracle_inst_group is not set (OK)
    from_location is not set (OK)
    tmp_netca_file is not set (OK)
    tmp_dbca_file is not set (OK)
    Working in /oracle/stage/102_32/database/SAP ...
    The environment variable ORACLE_HOME is not set! abort ...
    How to set environment variable ORACLE_HOME ?
    Regards
    Eric

    i
    Switch shell to bash:
    orassm:x:502:503:SAP Database Administrator:/oracle/SSM:/bin/bash
    [root@csp-p-sm00 ~]# su - orassm
    [orassm@csp-p-sm00 ~]$
    But when try to run ./RUNINSTALL
    [orassm@csp-p-sm00 SAP]$ ./RUNINSTALLER
    oracle_stage is not set (OK)
    oracle_base is not set (OK)
    oracle_home is not set (OK)
    oracle_sid is not set (OK)
    oracle_home_name is not set (OK)
    oracle_inst_group is not set (OK)
    from_location is not set (OK)
    tmp_netca_file is not set (OK)
    tmp_dbca_file is not set (OK)
    Working in /oracle/stage/102_32/database/SAP ...
    The environment variable ORACLE_HOME is not set! abort ...
    Additionaly I've post csh.cshrc and csh.login
    /etc/cshrc
    csh configuration for all shell invocations.
    by default, we want this to get set.
    Even for non-interactive, non-login shells.
    [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]
    if $status then
            umask 022
    else
            umask 002
    endif
    if ($?prompt) then
      if ($?tcsh) then
        set prompt='[%n@%m %c]$ '
      else
        set prompt=\[`id -nu`@`hostname -s`\]\$\
      endif
    endif
    if ( $?tcsh ) then
            bindkey "^[[3~" delete-char
    endif
    setenv MAIL "/var/spool/mail/$USER"
    limit coredumpsize 0
    if ( -d /etc/profile.d ) then
            set nonomatch
            foreach i ( /etc/profile.d/*.csh )
                    if ( -r $i ) then
                            source $i
                    endif
            end
            unset i nonomatch
    endif
    /etc/csh.login
    System wide environment and startup programs, for login setup
    if ($?PATH) then
            if ( "$" !~ /usr/X11R6/bin ) then
                    setenv PATH "$:/usr/X11R6/bin"
            endif
    else
            if ( $uid == 0 ) then
                    setenv PATH "/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
            else
                    setenv PATH "/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
            endif
    endif
    setenv HOSTNAME `/bin/hostname`
    set history=1000
    if ( ! -f $HOME/.inputrc ) then
            setenv INPUTRC /etc/inputrc
    endif
    Regards
    Eric

  • From Where should i download Servlets and how to set Environment variables?

    Hi,
    I want to download the Servlets Kit for my development of application,but couldnt find it.I found a zip file containing all class files.If that is the correct one,then how should i set my environment variables?
    thanks
    rao

    Your files should come in a folder with the name "Javax" and subfolders right?
    What you can do is to paste the file "Javax" in your folder of your JDK installation.
    For example, I have installed my JDK in C:\Java\jdk1.3
    I added one new folder in C:\Java\jdk1.3 called classes.
    Then I would put the Javax folder in classes.
    PS : We add one new folder called classes so that in future when you want to add new classes you can just into this folder.
    Then in your enviroment settings, simple point to C:\Java\jdk1.3\classes;.;
    This works for me. Hopefully you will no problems!
    jing
    170902

  • HOW TO ADD NEW VARIABLE DATAS ON ALV REPORT

    Hi gurus,
               I have cretaed one alv report using
    REUSE_ALV_GRID_DISPLAY.
    I HAVE CALCULATED SOME TOTALS AND STORED ON
    ONE VARIABLE .
    that variable name is 'toterror'.
    now i want to add  this variable on first line OF ALV REPORT.
    that is i should get LIKE THIS.
    PERNR   TEXT     ACTION  [ TITLES OF FIELDS ].THEN
    TOTAL ERROR RECORDS  '900'.
    THEN THE CORRESPONDING FIELDS DATA SHOULD BE DISPLAYED.
    HELP ME.
    THANKS IN ADVANCE.

    Hi
    Thanks Ajeet.
    The scenario is that I have to create a formula (contract end date-current date) and have to display the result using exeption to highlight the contracts ending in 30-60 days.
    The problem is that the info provider does not have any infoobject for date(only valid to and validity start date)
    I have created a formula variable on valid to date using replacement path. But dont have any variable to use for current date.
    The only time char in the cube is Fiscal yera variant.
    How should I go futher creating such formula? Shall I user customer exit variable? But I dont have any date char to create on.
    Can you shed some light on this problem
    Thanks

  • How to set environment variable?

    Hi,
    I just succeeded starting up an external executable by using nativeprocess.
    Now I have to set the portnumber as an environment variable.
    After setting this portnumber, I can send queries to the executable.
    But I don't now how to set this environment variable.
    You can see my try in bold:
    Starting the executable (an extract of the code):
    public var portnumber;
    file = file.resolvePath("C:\\Program Files\\CM Synergy 6.3\\bin\\start_dbase.exe");    #start executable
    process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, getportnumber);    #get portnumber as output of the executable
    The next step is to define the variable portnumber:
    file = file.resolvePath("C:\\WINDOWS\\system32\\cmd.exe");
    processArgs[0] = "/C";
    processArgs[1] = "set";
    processArgs[2] = "portnumber=";
    processArgs[3] = portnumber;
    When I try to print out all environment variables, portnumber is not in:
    file = file.resolvePath("C:\\WINDOWS\\system32\\cmd.exe");
    processArgs[0] = "/C";
    processArgs[1] = "set";
    If I replace the last executable with my real command (running the query), the executable is giving the error that my portnumber is not set.
    Is it possible? I have also tried it with setx.exe. Even running a python script where I set os.environ is not working.
    I have the feeling that the command is executed but that the variable is not remembered for the next executable.

    Hello Martin,
    Thanks for your input. I have tried what you suggested but it didn't work. I will post my source code. Perhaps I'm doing something wrong. After setting my variable portnumber, I would normally run a query. Instead of running the query, I'm writing out the environment variables. Unfortunately, portnumber is not in the list . I also tried using "setx" insetad of "cmd.exe set" but without any difference.
        public var portnumber;
        public function run_query():void
            var file:File = new File("C:/WINDOWS/System32/cmd.exe");
            var si:NativeProcessStartupInfo = new NativeProcessStartupInfo();
            si.executable = file;
            var processArgs:Vector.<String> = new Vector.<String>();
            processArgs[0] = "/C";
            processArgs[1] = "set";
            nativeProcessStartupInfo.arguments = processArgs;
            var process:NativeProcess = new NativeProcess();
            process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
            process.start(si);
        public function set_portnumber():void
            var file:File = new File("C:/WINDOWS/System32/cmd.exe");
            var si:NativeProcessStartupInfo = new NativeProcessStartupInfo();
            si.executable = file;
            var process:NativeProcess = new NativeProcess();
            process.start(si);
            process.standardInput.writeUTF("set portnumber="+portnumber+"\n")
            setTimeout(run_query, 1000);
        public function onOutputData(event:ProgressEvent):void
            var process:NativeProcess = event.target as NativeProcess;
            textReceived.text += process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable) + "\n";

  • How to pass environment variables to adf application?

    Hi,
    I Created form function with this settings to open my adf application:
    Type : SSWA plsql function
    Maint Mode = None
    Context : Resp
    Web HTML : test.jsp
    Web host: 192.168.1.30:8890
    This works fine. But how can I pass environment variables as parameters?
    I like to pass username and org_id.
    Thanks in advance

    KdeGraaf,
    Sounds real interestign what you are saying. But I don't know what you mean with:"the application server name appended till html folder($COMMON_TOP/html) "
    Basically if u make a SSWA jsp function with only jsp name say A.jsp.At runtime the url is automatically converted tohttp://<application server>:<port number>/OA_HTML/A.jsp
    By the way $COMMON_TOP/html folder is the location for all jsps' in EBS.
    Where can I find some information about making a OAF page wrapper? Because I have totaly now experience with OAF.
    Make a OAF page, say page A, in process request of page get all the context data say, responsibility, org etc, and set it in http session.Then redirect the flow to ur ADF application page. If ur new and have no knowledge how do we build a page in OAF, u can download OAF developers guide from metalink. Search old threads u would get get the metalink id.--Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to add System variable in a Query

    Hi Experts,
    In ref. to the below query.
    (SELECT T0.[CardCode], T0.[CardName], T0.[DocNum],T0.[Installmnt], T0.[DocDate], T0.[DiscPrcnt], T0.[DiscSum], T0.[DocTotal] FROM [dbo].[OINV]  T0 WHERE T0.[CardName] = [%0] )
    Can you please let me know how to add a System Variabe (i.e., AR Invoice --> Total before discount field --> Variable : 85) to the above query.
    Thanks in advance
    Regards,
    Rakesh N

    Hi Rakesh......
    Its definitely possible.
    Try this one....
    (SELECT T0.[CardCode], T0.[CardName], T0.[DocNum],T0.[Installmnt], T0.[DocDate], T0.[DiscPrcnt], T0.[DiscSum], T0.[DocTotal], Sum(T1.LineTotal) , T3.DocNum
    FROM [dbo].[OINV]  T0 Inner Join INV1 T1 On T0.DocEntry=T1.DocEntry Left Outer Join RIN1 T2 On T1.DocEntry=T2.BaseEntry Left Outer Join ORIN T3 On T3.DocEntry=T2.DocEntry
    WHERE T0.[CardName] = [%0]
    Group By T0.[CardCode], T0.[CardName], T0.[DocNum],T0.[Installmnt], T0.[DocDate], T0.[DiscPrcnt], T0.[DiscSum], T0.[DocTotal], T3.DocNum
    Hope this will help you.......
    Regards,
    Rahul

  • How to add environment entry in EJB3 ejb-jar.xml

    Hi,
    Is that a build in way of add environment entries in JDev for EJB 3 beans? For EJB 2 beans you can do that using properties. But the bean properties is not available in EJB 3. Please help.
    Thanks
    Kenny

    Thank you for the reply. But I need a way to enter env-entry value in ejb-jar.xml for EJB 3 in Jdev. In EJB 2, Jdev generate ejb-jar.xml for the bean and also let you add env-entry through bean's properties menu. But in there in no properties menu for EJB 3, also generated ejb-jar.xml is only a empty file doesn't contain any EJB depolyment information. That means you have to code ejb-jar.xml all manually.
    If I am wrong, can someone show me how to do this right?

  • How to read environment variable

    How do I read an environment variable within TS?
    I was thinking of calling getenv("VARIABLE_NAME") except it returns a char * and TS only allows Boolean or Numeric return type.
    I wonder if LV has any function for doing the same thing. 

    With the new ability in TestStand 4.2 to get the standard output from a command line, you can do this with a call executable step.
    Simply call cmd.exe as the executable, and pass it the following expression.  Then all you have to do is set Locals.EnvironmentVariableName to the name of the environment variable you want the value of and define where you want the standard output to be stored.
    "/C \"echo %"+Locals.EnvironmentVariableName+"%\""
    I'm attaching a sequence file that shows this.  The attachment is necessarily saved in TestStand 4.2, since it uses a feature introduced in that version.
    Josh W.
    Certified TestStand Architect
    Formerly blue
    Attachments:
    get env var.seq ‏6 KB

  • How to add project summary programmatically to publishing page.

    Let me know how to add project summary webpart to page in sharepoint 2013.

    Hi,
    Okay,
    check those links to add web part using code, try them and change the parameter to the name of the web part
    http://www.stefangordon.com/add-web-part-to-page-programmatically/
    http://blogs.msdn.com/b/tconte/archive/2007/01/18/programmatically-adding-web-parts-to-a-page.aspx
    http://nikpatel.net/2010/11/09/programmatically-add-the-web-part-on-the-sharepoint-web-part-page/https://manojssharepointblog.wordpress.com/2013/03/27/adding-and-removing-web-parts-programmatically-in-sharepoint/
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/1bc7212c-385d-4a89-9b7e-9d37ee762017/add-webpart-on-sharepoint-page-programmatically?forum=sharepointdevelopmentlegacy
    Kind Regards,
    John Naguib
    Technical Consultant/Architect
    MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
    Please remember to mark your question as answered if this solves your problem

  • How to set environment variables for Tomcat on mac osx 10.8.5

    How do I set up my environment variables - JAVA_HOME and CATALINA_HOME on my iMac running mac osx 10.8.5?

    You need to create a setenv.sh script in the tomcat bin directory. The link is an example that you will need adjust- http://www.unidata.ucar.edu/software/thredds/current/tds/tds4.2/tutorial/Getting Started.html

Maybe you are looking for