Within JBuilder, Reading Environment Variable From a BATCH File

Hi ppl:
Following my scenario without JBuilder. I would like to be able to do the same with JBuilder, so that I can run my application from within.
1. In the DOS window, I run a config.bat file that sets up a whole bunch of environment variables and then calls another script file that sets up another whole bunch to set up environment for a third party API (C++ based).
2. My application uses native methods to call the third party API which uses the environment variables set in step 1.
I know how to set the environment varialbes in JBuilder (Project Parameters, VM). However, I don't know how I can call a batch file that does the same. I don't want to set up the third party variables in JBuilder manually, since the script that sets them up checks on a few things to customize the environment.
I also know how to run a batch file from JBuilder, but that does not set the environment for the application. It seems like the batch file is run in a separate process.
Any ideas?
Kamran

It seems like the batch file is run in a separate process.Yes, it is. That's a design feature of Windows. The environment variables that a process creates are available to any subprocess, but when the process ends, the environment variables vanish. That's because they are part of the process, not global variables as you might wish.
So that's why your non-JBuilder scenario works; your C++ program is running in a subprocess of the process that defined the environment variables. And your JBuilder scenario doesn't work because the batch file it runs is in a process whose parent process is Windows, not JBuilder.

Similar Messages

  • At end of tether!  Reading in variables from a text file

    Hi all
    My stress factor has gone through the roof because I am trying to read in from a text file (you may have seen some earlir questions about ArrayLists) it's just not working!
    The code is below. The result is that it's reading in all of the car data, none of the motorbike and only the first line for the services. It's odd and it's driving me insane!
    Here's an example of the data it's reading. There are about 7-10 sets of data per type
    <car><reg>AB04CDE</reg><make>Ford</make><model>Fiesta</model><colour>blue</colour><passenger_no>4</passenger_no></car>
    <service><service_no>13570</service_no><reg>J605PLE</reg><date>15:07:2006</date><miles>20000</miles><part_replaced>brake_pads</part_replaced><part_replaced>front_tyres</part_replaced></service>
    <motorbike><reg>TT05EKJ</reg><make>Triumph</make><model>Speedmaster</model><colour>black</colour><load>20.50</load></motorbike>
    Here's the code
    while (moreToRead) {
            String line;
            try {
              line = fileReader.getNextStructure();
    // collect the data from the file
              if (line.indexOf("<car>")> -1){
                // Select/Extract the registration element
                int nStart = line.indexOf("<reg>");
                int nEnd = line.indexOf("</reg>");
                String reg = line.substring(nStart+5,nEnd);
                // Select/Extract the make element
                nStart = line.indexOf("<make>");
                nEnd = line.indexOf("</make>");
                String make = line.substring(nStart+6,nEnd);
                // Select/Extract the model element
                nStart = line.indexOf("<model>");
                nEnd = line.indexOf("</model>");
                String model = line.substring(nStart+7,nEnd);
                // Select/Extract the colour element
                nStart = line.indexOf("<colour>");
                nEnd = line.indexOf("</colour>");
                String colour = line.substring(nStart+8,nEnd);
                // Select/Extract the passenger_no element
                nStart = line.indexOf("<passenger_no>");
                nEnd = line.indexOf("</passenger_no>");
                String passenger_no = line.substring(nStart+14,nEnd);
                //convert string to int
                int passengerInt = Integer.parseInt(passenger_no);
                // declare new object car and assign the variables then add it to the array.
                Car c = new Car (reg, make, model, colour, passengerInt);
                carList.add(c);
      } else if (line.indexOf("<bike>")> -1) {
             // Select/Extract the registration element
             int nStart = line.indexOf("<reg>");
             int nEnd = line.indexOf("</reg>");
             String reg = line.substring(nStart+5,nEnd);
             // Select/Extract the make element
             nStart = line.indexOf("<make>");
             nEnd = line.indexOf("</make>");
             String make = line.substring(nStart+6,nEnd);
             // Select/Extract the model element
             nStart = line.indexOf("<model>");
             nEnd = line.indexOf("</model>");
             String model = line.substring(nStart+7,nEnd);
             // Select/Extract the colour element
             nStart = line.indexOf("<colour>");
             nEnd = line.indexOf("</colour>");
             String colour = line.substring(nStart+8,nEnd);
             // Select/Extract the load element
             nStart = line.indexOf("<load>");
             nEnd = line.indexOf("</load>");
             String load = line.substring(nStart+6,nEnd);
             //convert load string to double
             double bikeLoad = Double.parseDouble(load);
             // declare new object motorbike and assign the variables then add it to the array.
             Motorbike m = new Motorbike (reg, make, model, colour, bikeLoad);
             bikeList.add(m);
      } else  {
        // Select/Extract the service_number element
        int nStart = line.indexOf("<service_no>");
        int nEnd = line.indexOf("</service_no>");
        String service_no = line.substring(nStart+12,nEnd);
        console.println("service = " + service_no);
        nStart = line.indexOf("<reg>");
        nEnd = line.indexOf("</reg>");
        String reg = line.substring(nStart+5,nEnd);
        console.println("service = " + reg);
        nStart = line.indexOf("<date>");
        nEnd = line.indexOf("</date>");
        String date = line.substring(nStart+6,nEnd);
        console.println("service = " + date);
        nStart = line.indexOf("<miles>");
        nEnd = line.indexOf("</miles>");
        String miles = line.substring(nStart+7,nEnd);
        console.println("service = " + miles);
        nStart = line.indexOf("<part_replaced>");
        nEnd = line.indexOf("</part_replaced>");
        String part_replaced = line.substring(nStart+15,nEnd);
        console.println("service = " + part_replaced);
        //convert string to int
        int dateOfService = Integer.parseInt(date);
        //convert string to double
        double milesAtService = Double.parseDouble(miles);
        //convert service no to unique int
        int serviceNo = Integer.parseInt(service_no);
        // declare new object service and assign the variables then add it to the array.
        Service s = new Service (reg, part_replaced, serviceNo, dateOfService, milesAtService);
          serviceList.add(s);
          catch (Exception e) {
            // Run out of data
            moreToRead = false;
    } If anyone can spy anything that could be causing this I love your advice. I simply can't see it.
    Jo

    hi jos,
    we have been asked not to use a parser for this assignment. evil
    tutor i think! lolYour example seems to imply that all the <tag> ... </tag> pairs have
    to occur on a single line; if that is so, you can do some cheap
    programming like this:String getText(String line, String tag) {
       int start= line.indexOf("<"+tag+">");
       int end= line.indexOf("</"+tag+">", start);
       if (start < 0 || end < 0) return null; // no <tag> ... </tag> pair found
       // return the text in between the <tag> ... </tag> tags
       return line.substring(start+tag.length()+2, end);
    }kind regards,
    Jos

  • To read structure variable from a binary file

    Hi Everyone,
    Iam having a binary file created by c++.It contains structure  like this one...
    struct
          char name[2];
          unsigned short num;
          char identity[4];
          double date;
          union
              byte id[4];
              int sizeconst;
              int size;
    I want to read this struct file in labview. How can i do that?

    Once I had the same problem, I've asked NI-support and they said to me because of different kind of reading method that that operation is impossibile to do, so the solution to solve the problem has been to create a C++ library that reads the structure from the file and makes disponible the data. After, I've called the library by "Call by library function" in my Labview software.
    Ricky
    Italian Developer engineer
    www.www.selt-sistemi.com

  • How to access environment variables from Oracle Forms

    Hi,
    Any idea how to use the Environment variables from Oracle Forms.
    My basic problem is that from Oracle form I am calling Batch file which calls excel file with a macro.
    So i want to check whether the macro was successful or not.
    So in my batch file i will set %errorlevel% which I should be able to read from Oracle Forms.
    I am able to read the registry from oracle forms, so is there anyway to read environment variable as well?
    Thanks!
    Avinash.

    Hello,
    Use the TOOL_ENV.Getvar() built-in
    Francois

  • [SOLVED] Pass Environment variables from PKGBUILD to .INSTALL script

    Hi everyone,
                       I am trying to modify the grub2-efi-bzr (http://aur.archlinux.org/packages.php?ID=38369) package making some changes in the PKGBUILD and the post-install script. I want to pass few environment variables from the PKGBUILD to the install script. How do I do that?
    Some code from the PKGBUILD
    _bzrtrunk="lp:grub/grub2" # GRUB2 BZR Main Trunk
    # _bzrtrunk="lp:~skodabenz/grub/grub2-bzr-exp" # GRUB2 BZR Experimental Branch
    _bzrmod="grub2"
    if [ ${_bzrtrunk} = "lp:~skodabenz/grub/grub2-bzr-exp" ]
    then
    _bzrmod="grub2_exp"
    pkgver="exp_${pkgver}"
    fi
    # grub-extras bzr repo locations
    _bzrtrunk_zfs="lp:~skodabenz/grub/grub2-extras-zfs"
    _bzrtrunk_lua="lp:~skodabenz/grub/grub2-extras-lua"
    if [ "$CARCH" = 'i686' ]
    then
    _EFI_ARCH=i386
    elif [ "$CARCH" = 'x86_64' ]
    then
    _EFI_ARCH=x86_64
    fi
    # _EFI_ARCH=x86_64 # Uncomment if you want to override the if condition for _EFI_ARCH above, incase the EFI ARCH does not match the Linux Kernel ARCH.
    # $CARCH=x86_64 and _EFI_ARCH=i386 requires gcc-multilib with lib32-glibc installed in the system.
    # I do not know about $CARCH=i686 and _EFI_ARCH=x86_64
    if [ ${_EFI_ARCH} = "i386" ]
    then
    pkgver="${pkgver}_x86"
    _trns_name="grub2_efi_x86"
    elif [ ${_EFI_ARCH} = "x86_64" ]
    then
    pkgver="${pkgver}_x64"
    _trns_name="grub2_efi_x64"
    fi
    Now the post-install script needs the values of _EFI_ARCH and _trns_name env variables. I do not want to copy the if statements to that script as these are decided at compile time but needed while setting up grub2-efi. This is due to the fact that EFI-ARCH need not match the Linux Kernel ARCH. How do I do that.
    Code from the post-install script
    ${_trns_name}-install --root-directory=/ --no-floppy --recheck --debug
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/lua.mod /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/zfs.mod /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/zfsinfo.mod /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/unifont.pf2 /boot/${_trns_name}/
    cp /usr/lib/${_trns_name}/${_EFI_ARCH}-efi/ascii.pf2 /boot/${_trns_name}/
    ${_trns_name}-mkimage --verbose --directory=/usr/lib/${_trns_name}/${_EFI_ARCH}-efi --prefix="" --output=/boot/${_trns_name}/grub2.efi --format=${_EFI_ARCH}-efi ${_EFI_APP_MODULES}
    Thank in advance.
    Last edited by skodabenz (2010-07-27 15:46:40)

    falconindy wrote:
    Don't rely on %foo% existing -- it won't after the first build and this will prevent the PKGBUILD from being reentrant. I would use something like this (untested):
    sed -i "s|^\(_EFI_ARCH\)=.*|\1=${_EFI_ARCH}|; \
    s|^\(_trns_name\)=.*|\1=${_trns_name}|; \
    s|^\(export _EFI_APP_MODULES\)=.*|\1=${_EFI_APP_MODULES}|" \
    ${startdir}/grub2-efi-bzr.install
    Your code works except for 1 problem in the install script I want
    export __EFI_APP_MODULES="${_EFI_APP_MODULES}" (the passed ${_EFI_APP_MODULES} value should again come inside double quotes).
    right now
    export _EFI_APP_MODULES=ata part_gpt part_msdos fat ntfs ntfscomp ext2 iso9660 udf hfsplus fshelp normal chain linux ls search search_fs_file search_fs_uuid search_label help loopback boot configfile echo efi_gop efi_uga xnu xnu_uuid lvm
    which is equivalent to
    export _EFI_APP_MODULES=ata
    I want
    export _EFI_APP_MODULES="ata part_gpt part_msdos fat ntfs ntfscomp ext2 iso9660 udf hfsplus fshelp normal chain linux ls search search_fs_file search_fs_uuid search_label help loopback boot configfile echo efi_gop efi_uga xnu xnu_uuid lvm"
    How to do it with sed since sed already uses double quotes?

  • Setting windows environment variables from Java program

    Is there any way to set environment variables from Java program in Windows? Any help is appreciated.
    Here is my situation:
    I need to decrypt an encrypted Oracle user password in a batch file which will be used while running a sql script with sqlplus. I was planning to have bat file which will call a Java program decrypt the password and set it as an env variable in windows which will be available while calling sqlplus.
    thanks

    Runtime.exec has a lot of overloadings. Two of them
    allows you to specify the environment variables.
    exec
    public Process exec(String[] cmdarray,
    String[] envp,
    File dir)
    throws IOExceptionExecutes the specified command and
    arguments in a separate process with the specified
    environment and working directory.
    cmdarray - array containing the command to call and
    its arguments.
    envp - array of strings, each element of which has
    environment variable settings in format name=value.
    dir - the working directory of the subprocess, or null
    if the subprocess should inherit the working directory
    of the current process.
    I had this sample program:
    public class SetVarExample {
    public static void main (String[] args) throws Exception {
         String[] cmd_env= new String[] {"password="+"ABCD","Path=C:\\Sun\\AppServer\\jdk\\bin"};
         String cmd = "cmd /c SET ";
         Runtime.getRuntime().exec(cmd,cmd_env);
    System.out.println( "Finish ...." );
    I tried it in a command prompt. But looks like when the program exits, it's a whole new process and so it does not retain the env variables set in the java program.
    Any suggestions? Am I doing it worng?
    thanks

  • How to read Environment Variable in Java.

    Hi,
    I am trying to read a environment variable $TMP which has a value of /apps/bea/pt847/psoft5/tmp in UNIX.
    I have written the following code and getting Null pointer exception when calling the method logmessage. Any help with reading environment variable is appreciated.
    public static void logMessage(String message) {
           SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
           Date now = new Date();
           Properties p = null;   
           try
              p = getEnvVars("$TMP");
              System.out.println("the current value of TEMP is : " + p.getProperty("$TMP"));
           catch (Throwable e) {
              e.printStackTrace();
           try
           BufferedWriter os = new BufferedWriter(new FileWriter("/tmp/pscas_signon_log.txt", true));
           os.write(formatter.format(now));
           os.write(message);
           os.write("\n");
           os.write("tmp_env = " + p.getProperty("$TMP"));
           os.write("\n");
           os.close();
           catch(IOException _ex) { }
        public static Properties getEnvVars(String env_var) throws Throwable {
           Properties envVars = new Properties();
           Process p = Runtime.getRuntime().exec(env_var);
           BufferedReader br = new BufferedReader( new InputStreamReader( p.getInputStream() ) );
           String line = null;
           while( (line = br.readLine()) != null ) {
              int idx = line.indexOf( '=' );
              String key = line.substring( 0, idx );
              String value = line.substring( idx+1 );
              envVars.setProperty( key, value );
              // System.out.println( key + " = " + value );
           return envVars;
        }

    Updated code:
    public static void logMessage(String message) {
           SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
           Date now = new Date();
           Properties p = null;   
           try
              p = getEnvVars("$TMP");
              System.out.println("the current value of TEMP is : " + System.getProperty("$TMP"));
           catch (Throwable e) {
              e.printStackTrace();
           try
           BufferedWriter os = new BufferedWriter(new FileWriter("/tmp/pscas_signon_log.txt", true));
           os.write(formatter.format(now));
           os.write(message);
           os.write("\n");
           os.write("tmp_env = " + System.getProperty("$TMP"));
           os.write("\n");
           os.close();
           catch(IOException _ex) { }
        public static Properties getEnvVars(String env_var) throws Throwable {
           Properties envVars = new Properties();
           Process p = Runtime.getRuntime().exec(env_var);
           BufferedReader br = new BufferedReader( new InputStreamReader( p.getInputStream() ) );
           String line = null;
           while( (line = br.readLine()) != null ) {
              int idx = line.indexOf( '=' );
              String key = line.substring( 0, idx );
              String value = line.substring( idx+1 );
              envVars.setProperty( key, value );
              // System.out.println( key + " = " + value );
           return envVars;
        }and this is the error message..
    java.io.IOException: $TMP: not found
            at java.lang.UNIXProcess.forkAndExec(Native Method)
            at java.lang.UNIXProcess.<init>(UNIXProcess.java:72)
            at java.lang.Runtime.execInternal(Native Method)
            at java.lang.Runtime.exec(Runtime.java:602)
            at java.lang.Runtime.exec(Runtime.java:461)
            at java.lang.Runtime.exec(Runtime.java:397)
            at java.lang.Runtime.exec(Runtime.java:359)
            at SimpleCasValidator.getEnvVars(SimpleCasValidator.java:108)
            at SimpleCasValidator.logMessage(SimpleCasValidator.java:81)

  • How to get an environment variable from OS in class ?

    Hello,
    How to get an environment variable from OS in class ?
    Thanks !

    An example of a Java application that does this is Ant, when you add a line like this in your build.xml:
    <!-- Import environment variables -->
    <property environment="env"/>
    I have looked at the source code of Ant 1.3, especially the file src/main/org/apache/tools/ant/taskdefs/Execute.java. Look at the methods getProcEnvironment() and getProcEnvCommand(). Ant uses an OS-dependent trick to get the environment variables.
    You can download the Ant source code from http://jakarta.apache.org/ant
    Jesper

  • How to access environment variables from pluggable destination?

    Hi,
    I'm trying to create a java puggable destination for reports. Everything is working fine.
    I want to access reports environment variables from the java code (like REPORTS_PATH and other new variables that I want to create), but I can't find anything about this in the java API documentation.
    I want to use environment variables instead of destination properties (those I can easily access), because I want to be able to change context using env_id.
    Any ideas?
    Thanks,
    Luis

    I'm using Oracle Application Server Version 10.1.2.0.2
    Thanks

  • Using 10g SQL Plus from a batch file

    I installed the Oracle Database 10g Express Client and configured my ODBC and tnsnames.ora settings, and I think I have it all right, because when I open the SQL Command Line I can connect to the database just fine using:
    connect <username>/<password>@<database>
    However, when I try to log in through a non-SQL command line or batch file using the syntax:
    sqlplus <username>/<password>@<database>
    I get the error "ORA-12154: TNS:could not resolve the connect identifier specified." That syntax used to work for me with 9.2. Does the functionality still exist in 10.2?
    Update #1:
    The sqlplus login works from a normal command widow if I first CD C:\XEClient\bin. I still can't get it to work from a batch file, even when I specify the path. Does this mean the batch file command can't find my tnsnames.ora? If so, what environment variable do I need to set? I already have the client directory in the Path and ORACLE_HOME variables.
    Update #2:
    I started randomly trying every Oracle environment variable I could find a reference to, and found that setting TNS_ADMIN to the C:\XEClient\bin directory worked.
    I don't need any responses to this post, so it can be deleted by an admin.
    Edited by: user11241849 on Jan 13, 2010 12:05 PM

    Hi Toni,
    It is my first post here and I though telepathy already operated here :)
    it is Oracle 9 I am talking about.
    actually, I have 2 batch files
    File 1, lets say the file name is batch1.bat and the contents are
    sqlldr user/pwd@tnsname control='Control.ctl'  data='data.txt'
    File 2, batch2.bat and the contents are
    Batch1.bat
    Sqlplus user/pwd@tnsname @callproc.sql
    Now if I run Batch2.bat, then only the first line to be executed which calling the batch1.bat , the second line (sqlplus) never executed!
    Best Regards,
    Yousef
    Edited by: yousef_bayyari on 10-Nov-2009 06:25

  • Populate a table reading the data from a TXT file

    how can I populate a table reading the data from a TXT file?
    thanks

    Hey Kevin!
    Using FORMS.TEXT_IO to bulk load data from a file strikes me as re-inventing the wheel. It is just about justifiable in a self-service environment, but I regard the EXTERNAL TABLE is a better solution for that situation as well.
    The same applies to UTL_FILE. I think the ability to read text with UTL_FILE is primarily intended for read file-based configuration or file manipulation/processing rather than data loading.
    Re-writing a text file into SQL statements is too much like hard work (even with an editor that supports macro definition and regular expressions) for no real benefit. You lose all the bulk load peformance you would get from SQL*Loader. But for QAD I'd probably let you off with it.
    You missed out one obvious alternative: using Java to turn the contents of an XML file into a CLOB and inserting it into a table which is read by a PL/SQL procedure that parses the XML records and insert the retrieved data into a table.
    Stay lucky, APC

  • How to execute a  .sql file from a batch file

    Hi all
    I've to take backup of a database weekly twice on every wednesday & Friday @ 5pm IST. I've written a hot backup script, which works every well.
    now i want to automate the script. ie i want this script to run on wednesday & friday @ 5pm without any human interfearance ie with out actually any1 executing this script.
    i created a batch file prod.bak with the following lines
    @echo off
    set oracle_sid=testdb
    set oracle_home=d:\oracle\ora92
    sqlplus /nolog
    connect sys as sysdba/oracletest@testdb
    this batch file when eexecuted connects me to sql prompt.
    Now i want to execute my backup script bkp.sql automatically when it is connected to sql prompt.
    (i tried with these lines in the above batch file...
    call bkp.sql---it just opens the bkp.sql file in notepad & displays the script
    start bkp.sql---same as call
    connect / as sysdba/pwd@[email protected] --- does not work simply remains a the sql prompt.
    At 17:00 /Every:w,f "d:\bkp.sql"---does not work simply remains at the sql promt.)
    Can any1 let me know what should i write in the batch file that will execute the bkp.sql file automatically after it gets connected to sql prompt. M using oracle 9i.
    I'll manage he time through windows utility of scheduling task.. Let me know how to execute the .sql file from a batch file.
    Thanks
    Tripti

    Try
    sqlplus "sys/oracletest as sysdba" @bpk.sql
    Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
    Remember to put an exit at the end of the bpk.sql script.

  • How to run 11g Form from a batch file (.bat) !

    Hi,
    Previously, I run my Form 6i from a batch file (with Windows Schedular Tasks) as below;
    E:\orant\bin\ifrun60.exe e:\lock.fmx
    This form lock some items on a certain date (with the help of Windows Schedular Task).
    How can this possible in Forms 11g ?
    Kindly guide !
    Regards.
    Vick.

    Well are you talking about doing that on a free standing/developer machine or are you thinking of on the
    server? In any case forms6i was a native application and forms11 is a web application that requires weblogic, even on the developer machine.
    I think you will have to start from square one describing what you are trying to do.
    Soapbox: I really think if forms "went back" to having a native deployment option it would be highly treasured. Here is a case where we are still running 6i for that reason. We have a situation where they interview clients at another location using a laptop. The laptop form brings up successive question screens, which questions are asked of the clients and their responses recorded. If the interview data is lost we cannot bring these people back and do it over. In the meantime the wifi connecting back to the database server can go bad. It can get over-loaded, it can just crap out. The firewalls on the way can decide rightly or wrongly to time the connection out. There's a bunch of ways the connection can get dropped. So what we do is that form saves a copy of the data to the disk in a file before it tries to submit it to the database, which could fail. So we have a backup. Can't easily do that in 11. I have yet to have gotten webutil to work. It's a mobile option that is becoming popular and forms should do it, have the ability for the form to run independently on the client including an ability to save data and of course if you saved it, people will want to be able to sync it back to the database when the client is reconnected.

  • Retrieving process id from a batch file

    Hi friends,
    I am having a problem to retrieve the process id from a batch file. I will give the code which I have written and if anyone can help me it will be grateful. I am having time pressure. Here when I call
    Process p = rt.exec("checkExec.bat");
    the process is getting created. What I need is "I have to get the process id inside the batch file and then I have to store that process id to a file. My problem is "HOW CAN I GET HOLD OF PROCESS ID". Please give some guidance.
    !!!!THANKS IN ADVANCE !!!
    PROCESSTEST:
    public class ProcessTest {
         * @param args
         public static void main(String[] args) throws IOException {
              Runtime rt = Runtime.getRuntime();
              try {
                   Process p = rt.exec("checkExec.bat");
              } catch (IOException e) {
                        e.printStackTrace();
    CHECKEXEC.BAT
    cd bin
    java duo.CalledProcess
    CALLEDPROCESS
    public class CalledProcess {
         * @param args
         public static void main(String[] args) {
              try {
                   Runtime rt = Runtime.getRuntime();
                   synchronized (rt) {
                        while(true){
                             rt.exec("notepad");
                             long sec = 100000;
                             rt.wait(sec);
              } catch (InterruptedException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }

    problem is "HOW CAN I GET HOLD OF PROCESS ID".You can take it from the Operating System using JNI.

  • Use environment variables in logging.properties file

    is there a way to use environment variables in logging.properties file?
    like this -
    java.util.logging.FileHandler.pattern = {$MY_BASE_LOG_FOLDER}/myapp1/log/123%g.logdo I have to write a custom logging.properties loader? if yes, then are there any examples on this?

    I'm sorry, but don't you think your answer is useless?
    Maybe I haven't made my question clear enough. I need to know if java.util.logging recognizes environment variables in logging.properties files.
    If it does not, then there should be a well-known class to use instead of standard loader for logging.properties (java api mention one briefly).

Maybe you are looking for