Runtime.exec Problem with setting environment

Hello
I will run a command with a new process environment. As example I take "ls". If I use the "exec(String)" method it works fine (like it should; my PATH is ...:/usr/bin:...).
Next when I use "exec(String cmd, String[] env)" with cmd = ls and env = {PATH=} then the programm also prints out the listing of the current directory. In my opinion this shoudn't work.
I have the problem using jdk1.2.2 (Solaris VM (build olaris_JDK_1.2.2_10, native threads, sunwjit)) on Solaris 8.
As I understand the exec the method should work like this:
1. fork a new Process
2 set environment for the new process
3 exec the new Programm in this process
Is this statement right?
On Solaris 2.6 the program works fine and I get an IOException.
Some hints way the env for the process isn't set?
Thanks
========================================================
import java.io.*;
public class Test {
/** Version der Klasse. */
public static final String VERSION = "$Revision:$";
public static void main(String[] arg) {
try {
call("ls", new String[]{"PATH="});
} catch (Exception ex) {
System.out.println(ex);
private static void call(String cmd, String[] env)
throws Exception
Runtime rt = Runtime.getRuntime();
try {
System.out.println(cmd);
Process p = rt.exec(cmd, env);
StreamGobbler errorGobbler = new
StreamGobbler(p.getErrorStream(), "ERROR", System.err);
StreamGobbler outputGobbler = new
StreamGobbler(p.getInputStream(), "OUTPUT", System.out);
errorGobbler.start();
outputGobbler.start();
try {
p.waitFor();
} catch (InterruptedException e) {
if (p.exitValue() != 0) {
throw new Exception("Process failed");
} catch (IOException ex) {
System.out.println("IOException: " + ex.toString());
class StreamGobbler extends Thread {
private InputStream m_input;
private OutputStream m_output;
private String m_type;
private StringBuffer m_message;
StreamGobbler(InputStream is, String type, OutputStream os) {
this.m_input = is;
this.m_output = os;
this.m_type = type;
this.m_message = new StringBuffer();
outputGobbler.start();
try {
p.waitFor();
} catch (InterruptedException e) {
if (p.exitValue() != 0) {
throw new Exception("Process failed");
} catch (IOException ex) {
System.out.println("IOException: " + ex.toString());
class StreamGobbler extends Thread {
private InputStream m_input;
private OutputStream m_output;
private String m_type;
private StringBuffer m_message;
StreamGobbler(InputStream is, String type, OutputStream os) {
this.m_input = is;
this.m_output = os;
this.m_type = type;
this.m_message = new StringBuffer();
public synchronized void run() {
try {
InputStreamReader reader = new InputStreamReader(m_input);
BufferedReader bufferedReader = new BufferedReader(reader);
PrintWriter writer = new PrintWriter(m_output, true);
String line = null;
while ( (line = bufferedReader.readLine()) != null) {
writer.println(m_type + "> " + line);
this.m_message.append(m_type + "> " + line + "\r\n");
} catch (IOException ioe) {
ioe.printStackTrace();
public synchronized String getMessage() {
return this.m_message.toString();

I'm having the same problem...
Have you been able to solve your problem yet?

Similar Messages

  • Runtime exec problem with command "start"

    L.S,
    I'm working on a webservice client for uploading
    and downloading files. When a file is downloaded, it
    should be opened by the appropriate application. I
    know that this is -in theory- possible by issuing a
    start command through Runtime.getRuntime.exec():
    public void doSomething(String realName, DataHandler handler) {
      File outFile = new File(realName);
      FileOutputStream out = new FileOutputStream(outFile);
      handler.writeTo(out);
      out.close();
      String fileName = outFile.getAbsolutePath();
      Process p = Runtime.getRuntime().exec("start " + fileName);
    }Running this on my Win2000 system with J2RE 1.4.2 consistently
    fails with this message:
    java.io.IOException: CreateProcess: start C:\tmp\test.pdf error=2When I issue the exact same command from a DOS shell, Adobe
    starts up with the test document loaded. I now believe that my own
    application is somehow 'holding on to' the file, preventing an
    external application like Adobe from consuming the same file.
    Does anyone know how I can get around a problem like this? How do
    I start the appropriate application and feed it the file that was
    just downloaded by the user?

    I did a search for Runtime.exec and found some good help in this forum. Someone posted something like the following and it works pretty well.
    <<begin code>
    // Determine proper shell command (extend per OS)
    String os_name = System.getProperty("os.name");
    String shellParam "";
    if (os_name.startsWith("Windows"))
    if ( (System.getProperty("os.name").endsWith("NT")) ||
    (System.getProperty("os.name").endsWith("2000")) ||
    (System.getProperty("os.name").endsWith("XP")) )
    shell = "cmd.exe";
    } else
    shell = "command.com";
    shellParam = "/C";
    // Create a string with your program executable
    String command = "myprogram.exe";
    // Create an array of each command, I found that placing "cmd.exe /c"
    // in the same string doesn't work.
    String[] cmd_array = new String[] {
    shell,
    shellParam,
    command
    Runtime.getRuntime().exec( cmd_array );
    <<end code>>
    Do a java API search for Runtime.exec (if you use Eclipse right click and hit Open Declaration) there are ways to invoke exec that support setting of the environment as well as the current directory.

  • Runtime.exec() problem with Linux

    Hi All,
    I have a java program which I am using to launch java programs on all platforms.
    I am using the Runtime.exec() method to start the process in a separate JVM.
    But, I had a problem with the -classpath switch if the directories contained spaces. So I modified the java command which I am passing to the exec() method to something like:
    java -classpath \"./my dir with spaces\" com.harshal.MainThis I had to do because of the problem in windows. But, if I use double quotes in Linux (for the classpath switch in my exec() method), it won't work.
    Can anyone correct me so that I can use the Runtime.exec() method on all platforms to launch the java application even if the classpath directories contains spaces.
    Thank you very much.

    I was reading about the command line args on java's
    tutorial and I found a shocking news. Mac OS doesn't
    support command line args, That's news to me. Could you please elaborate ?
    More important is: I got it working. I figured out I had forgotten to try something before, or, to be more correct, I made an error when trying malcommc's envp suggestion: I used "classpath" as key, not "CLASSPATH", as it should have been.
    Ran a new test, got it working.
    Sample:
    Given a rootdir. Subdirectory "cp test" with a classfile (named "test") without package declaration. Running another class in another directory, using:
    String[] cmd = new String[]{
        "java", "test"
    String[] envp = new String[]{
        "CLASSPATH=rootdir:rootdir/cp test" // <-- without quotes.
    Runtime.getRuntime().exec(cmd, envp);It's been my wrong all the time. I didn't check hard enough. It simply had to work somehow (that's the kind of things that's easy to say afterwards :-)).

  • Problem with setting Item level permissions lists

    Hello!
    I have SPS 2013 on-premised environment with AD authentication.
    At some moment I've noticed that we have a problem with setting the item level permissions on any lists except the document libraries.
    When I click the "shared with" button I see a popup form with a list of users who have an access to that list but there is no "invite people" link or "Advanced" link. Moreover, the "loading" ring rotates
    instanly like some operation was'nt ended. 
    The same operation with documents in libraries works well.
    I am be grateful for any help!

    Hi Mischael,
    From your description, my understanding is that there were no "invite people" or "Advanced" link when some users clicked "shared with" button in some lists.
    This issue seems like about permissions. Please log on your site with site collection administrator or a user who has full control for the site, then go to a problematic list->List settings->Permissions for this list, check whether the list
    has unique permissions. Then click "Check Permissions", check the permission level for the problematic users and then go to Site Settings->Site permissions->Permission levels, check whether the permission level contains "Manage permissions".
    If not, add the permission into the permission level.
    Thanks,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Problem with Set/Get volume of input device with single channel

    from Symadept <[email protected]>
    to Cocoa Developers <[email protected]>,
    coreaudio-api <[email protected]>
    date Thu, Dec 10, 2009 at 2:45 PM
    subject Problem with Set/Get volume of input device with single channel
    mailed-by gmail.com
    hide details 2:45 PM (2 hours ago)
    Hi,
    I am trying to Set/Get Volume level of Input device which has only single channel but no master channel, then it fails to retrieve the kAudioDevicePropertyPreferredChannelsForStereo and intermittently kAudioDevicePropertyVolumeScalar for each channel. But this works well for Output device.
    So is there any difference in setting/getting the volume of input channels?
    I am pasting the downloadable link to sample.
    http://www.4shared.com/file/169494513/f53ed27/VolumeManagerTest.html
    Thanks in advance.
    Regards
    Mustafa
    Tags: MacOSX, CoreAudio, Objective C.

    That works but the the game will not be in full screen, it will have an empty strip at the bottom.
    I actually found out what's the problem. I traced the stageWidth and stageHeight during resizing event. I found out that when it first resized, the stage width and height were the size with the notification bar. So when I pass the stage into startling, myStarling = new Starling(Game,stage), the stage is in the wrong size. For some reason, I can only get the correct stage width and height after the third resizing event.
    So now I need to restart Starling everytime a resizing event happened. It gives me the right result but I am not sure it is a good idea to do that.
    And thanks a lot for your time kglad~I really appriciate your help.

  • Problem with SET GET parameters

    Hi all,
    I am facing a problem using SET and GET parameters.
    There is a Z transaction(Dialog program) where some fields of screen are having parameter ID's. That transaction is designed to diaplay/change status of only one inspection lot at a time.
    Now I need to call that transaction in a loop using BDC. I mean i need to update the status of multiple inspection lots(one after the other). Before calling the transaction I am using
    SET PARAMETER ID 'QLS' FIELD lv_prueflos.
    Unfortunately the transaction is only changing the first inspection lot. When I debugged I found that the screen field is changing in PAI. Even though in PBO it shows the next value, when it goes to PAI it is automatically changing to the first value(inspection lot).
    Example: Inspection Lots : 4100000234
                                               4100000235
                                              4100000236
    Now first time when the call transaction is being made the status of insp lot 4100000234 is changed. For the second time when insp lot 4100000235 is being passed in PBO ican see this. But the moment it enters PAI the screen field changes to 4100000234.
    Could you pls help me in solving this issue.
    Thanks,
    Aravind

    Hi,
    Problem with SET GET parameters
    Regarding on your query. Follow this below link.
    It will help you.
    Re: Problem with Set parameter ID
    Re: Problem in Set parameter ID
    I Hope it will helps to you.
    Regards,
    Sekhar

  • Button in Bex Analyser 7.0 - problem with setting up Static Parameters

    Hello,
    I know a similar problem has been discussed here already, but I am still having problems with setting up Static Parameters of my Button in BEx Analyser 7.0, so that I can pass Variable values from that button to my query.
    This is what I do - in Static Parameters of my Button I set the following values:
    Name                          Index          Value
    DATA_PROVIDER        0               DP_1
    CMD                             0               PROCESS_VARIABLES
    SUBCMD                      0               VAR_SUBMIT
    VAR_NAME                 0               0RMA_FIP
    VAR_VALUE               0               004/2010
    As a result, I would like the value 004/2010 to be passed to variable 0RMA_FIP (which is mandatory) and the query to be executed with that value. For some reason, however, the value is not passed correctly, and instead the variable is filled with a blank or not filled at all, and I am getting a message "Specifiy value for variable Fiscal year/period". What do I do wrong?
    Just to give you a broader picture - I would like to later use this logic to pass more than one variables into a query, including a hierarchy node, and read the values from an Excel worksheet - however, after many attempts to do so, I started playing with just one variable to figure out what the problem was.
    I have already seen the following two threads and SAP notes on passing variable values from the button:
    Re: Button in BEx Analyzer 7.0
    Re: How to set variables values via VBA.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be?quicklink=index&overridelayout=true
    Can anyone please advise?
    Cheers,
    AL

    I managed to figure it out myself!
    Instead of VAR_VALUE I need to enter VAR_VALUE_EXT, and it works fine.
    I will mark this thread as "answered".

  • Problem with setting Source Level in Sun Studio 2

    I've got problem with setting Source Level to 1.5 in Sun Studio 2. When I try to set it to 1.5 in Project properties and click Ok everything seem to go well, but when I open Project Properties again Source Level is set to 1.4. I need this to work cause I started to lear Java recently and I want to use foreach loop.
    Please help

    I'm just citing an example using Date().
    In fact, whether I use DateFormat or Calendar, it shows the same result.
    When I set the date to 1 Jan 1950 0 hours 0 minutes 0 seconds,
    jdk1.4.2 will always return me 1 Jan 1950 0 hours 10 minutes 0 seconds.
    It works correctly under jdk1.3.1

  • Problems with setting up my ISP's mail server in Windows Live Mail and Thunderbird

    The laptop is a G60-535DX with Windows 7  64 bit. I've managed to setup my gmail account fine in Live Mail, but when setting  up my ISP' mail server, it doesn't work. I get the message that the information was entered correctly, and I see the 'connecting' at the bottom of the page, and then 'error', and clicking on it shows a socket error #10061. In Thunderbird, I get a timeout error message. I've entered all the incoming and outgoing server information correctly, (I've done this over 8-9 times now), the ports are the defaults(110,25), no SSL, no authentication. I've talked with my ISP several times. Just a couple of hours ago was the last time. Their only other possibilities were that Live Mail had problems with setting up more than one account, that Live Mail needed updating, that Windows 7 was a new operating system and there were 'kinks'. I removed the gmail account, set up the ISP's mail by itself; didn't help. I checked for Live Mail updates, but found out that they all come from Windows updates(which are current).  The folks on PCQ&A inform me that they have 3 or 4 accounts with Live Mail. I can get my mail, by logging onto my ISP's website, but that' kind of a nuisance. I posted this in Seven Forums and they didn't have any ideas. As I said, I also can't get my mail server to work in Thunderbird, either.  I don't know what else to try. (short of activating the recovery partition and starting from scratch). Any ideas would be more that welcome.
    Thanks,
    Steve

    Stevehiker wrote:
    Nevermind, it's fixed. One of the guys on PCQ&A suggested going to my ISP's website to see if they had a support page. They did and it stated that under certain circumstances that for the login ID the whole email address should be entered. For XP and Outlook Express one only uses the first part of the email address (your name); so just for grins I entered the whole address, name and all and everyting worked. Called my ISP and was told that that wasn't the way it's supposed to work. Well----
    Thanks anyway,
    Steve
    Mine works the same way_must enter full email address as login. AT&T?
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • Obiee 11g . problem with set default as columnname in interaction tab

    Hi Obiee gurus ,
    I have small problem with set default option in interaction tab in column properties. actually my problem is , i changed one column bold save as set default option bold and how to revert back to my column option. when i create new analysis with same name . it takes set default option for that column.
    can Please give some suggestion for this problem.
    regards
    Srinivas

    Hi Srinivas,
    i guess this will be same for 11G
    Refer
    http://blogs.oracle.com/siebelessentials//2008/08/remove_systemwide_default_sett.html
    thanks,
    Saichand.v

  • I just bought an AirPort Extreme system over this weekend and I am having problem with setting it up. I plugged the cable as explained in the manual but there is no way I can get a steady green light. I all see is flashing amber light. Can anyone help me,

    I just bought an AirPort Extreme system over this weekend and I am having problem with setting it up. I plugged the cable as explained in the manual but there is no way I can get a steady green light. I all see is flashing amber light. Can anyone help me,

    Think you need to provide some more details about what you are connecting

  • Java.lang.Runtime.exec problem in ubuntu 9.10

    Hi:
    I tried to run some command in the java code , for example "grass64 -text /home/data/location", this command works well in the terminal, however when I call it in the java code I got some excepetions.
    My code is :
    public class Grass {
         public static String grassBatJob="GRASS_BATCH_JOB";
         public void run(String cmd,String jobPath) {
              //set the environments variables
              Map<String, String> env=new HashMap<String, String>();
              env.put(grassBatJob, jobPath);
              String gisDataBase="/home/kk/grass/GrassDataBase";
              String location="spearfish60";
              String mapset="PERMANENT";
              cmd=cmd+" "+gisDataBase+"/"+location+"/"+mapset;
              CommandLine line=new CommandLine(cmd);
              //the real cmd should be >>grass64 -text /home/kk/grass/GrassDataBase/spearfish60/PERMANENT
              System.out.println("start line=="+line.toString());
              DefaultExecutor de=new DefaultExecutor();
              try {
                   int index=de.execute(line,env);
                   System.out.println(index);
              } catch (ExecuteException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
         public static void main(String[] args) {
              String jobPath=Grass.class.getResource("grass.sh").getFile();
              new Grass().run("grass64 -text", jobPath);
    The real cmd I want to execute is "grass64 -text /home/kk/grass/GrassDataBase/spearfish60/PERMANENT" with the envrionment variable "GRASS_BATCH_JOB=jobPath",it works well in the ternimal ,however in my application I got the exception"
    java.io.IOException: Cannot run program "grass64 -text /home/kk/grass/GrassDataBase/spearfish60/PERMANENT": java.io.IOException: error=2, No such file or directory
         at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
         at java.lang.Runtime.exec(Runtime.java:593)
         at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
         at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:246)
         at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:302)
         at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:149)
         at org.kingxip.Grass.run(Grass.java:27)
         at org.kingxip.Grass.main(Grass.java:38)
    Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
         at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
         at java.lang.ProcessImpl.start(ProcessImpl.java:65)
         at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
         ... 7 more
    I wonder why?

    Thanks for all of your reply, and now I can run the command, however I met some problems when I tried to get the result of the exec.
    The core codes are shown below:
    String cmd="g.version";
    String[] exe={"bash","-c",cmd};
    Process p1=Runtime.getRuntime.exec(exe,env); // the env has been set
    GrassThread outThread=new GrassThread("out", p1.getInputStream());
    outThread.start();
    GrassThread errorThread=new GrassThread("error", p1.getErrorStream());
    errorThread.start();
    int exitVal = p1.waitFor();
    String resu=outThread.sb.toString();
    System.out.println("==========the output start========");
    System.out.println(resu);
    System.out.println("==========the output end========");
    System.out.println("ExitValue: " + exitVal); //------------------> line one
    public class GrassThread extends Thread{
         public StringBuffer sb=new StringBuffer();
         public GrassThread(String type,InputStream is) {
              this.type=type;
              this.is=is;
         public void run() {
              try {
                   InputStreamReader isr = new InputStreamReader(is);
                   BufferedReader br = new BufferedReader(isr);
                   String line = null;
                   while ((line = br.readLine()) != null) {
                        System.out.println(type + ">" + line);
                        sb.append(line).append("\r");  // ----------------------------> line two
    }I define a StringBuffer in the GrassThread to save the output (see the code where I marked by "line two"), and when the process complete, I check the StringBuffer to get the output (see code where I marked by "line one"), however the output in the console of the IDE are :
    ----------- output in the console of the IDE start -------------
    ==========the output start========
    ==========the output end========
    ExitValue: 0
    out>GRASS 6.4.0RC5 (2009)
    ----------output in the console of the IDE end--------------------
    I can not understand, in the code "line one", I first get the output using "System.out.println(resu);",then I print the exitvalue,but why the order of the output in the console is not what I expected?
    Another question, the code above assume the output can be got from the Process's getInputStream, however sometimes the output maybe come from the Process's getErrorStream, so how to handle it?
    Edited by: apachemaven on 2010-3-5 ??5:38

  • Runtime.exec() - Problem when using cvs-command

    I have a problem with the Runtime.getRuntime().exec() - Command. I try to execute a command to export files from our cvs-repository. As you hopefully know, cvs produces a lot of output.
    When I start my 'cvs export ... '- command from the console-window of windows, everything works perfect. But when I try to use the Runtime.getRuntime().exec("CVS export ...") the created cvs-subprocess stops after the export of the first three files. When I close the main-window, where the cvs-process was started from, the cvs-process continues working.
    I could see, that many others had the same problem, but I couldn't find a real solution there.
    Is there a possibility to clear/delete the output-buffer of the cvs-subprocess, because I don't really need the information, that cvs gives me. It is enough for me when cvs stores the files :-)
    My source:
    public void executableTest()
    Runtime run = Runtime.getRuntime();
    try
    Process cvsProcess = run.exec("cvs export .... ");
    cvsProcess.waitFor();
    BufferedReader in = new BufferedReader
              ( new InputStreamReader(cvsProcess.getInputStream()) );
         String line;
         while ((line = in.readLine()) != null)
              System.out.println(line);
         catch (Exception e)
         System.out.println(e.getMessage());
    Thanks for your help.

    if the buffer is overflowing, then you don't want to do the waitfor until after you've hit the end of the inputstream, me thinks.

  • Runtime.exec() hangs with 1.4.1

    Hello altogether,
    I am trying to execute a command with Runtime.getRuntime.exec()
    I have already taken care of capturing the output and I observe that depending of the program I try to execute the process hangs.
    I am using JRE 1.4.1_02 under Redhat 7.2 with kernel 2.4.18-26
    Executing the same program under JRE 1.3.1 the program does not hang.
    Executing 'top -bn0q' hangs, executing 'ls -als' it hangs.
    Here is my sample code:
    <code>
    import java.io.*;
    public class Exec
    /** catches the output in a parallel thread */
    class StreamReader extends Thread
    String category = null;
    InputStream is;
    StreamReader(String category, InputStream is)
    this.category = category;
    this.is = is;
    public void run()
    try
    System.out.println(this.category+": reader runs");
    InputStreamReader isr = new InputStreamReader(this.is);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    while (br.ready() && (line = br.readLine())!=null)
    System.out.println(this.category+':'+line);
    catch (Exception e)
    e.printStackTrace();
    public void run(String[] cmd)
    StringBuffer outStrBuf = new StringBuffer();
    try
    Runtime rt = Runtime.getRuntime();
    System.out.println("got runtime");
    Process process = rt.exec(cmd);
    System.out.println("fired cmd");
    // any errors
    System.out.println("prepare error stream");
    StreamReader errSr = new StreamReader("ERR",process.getErrorStream());
    // any output
    System.out.println("prepare output stream");
    StreamReader outSr = new StreamReader("OUT",process.getInputStream());
    // start the readers to read
    System.out.println("start readers");
    errSr.start();
    outSr.start();
    System.out.println("waiting for process to end");
    process.waitFor(); //Waits for the subprocess to complete.
    catch (Exception e)
    System.err.println("Error while executing cmd: " + cmd);
    e.printStackTrace();
    System.out.println(outStrBuf);
         public static void main(String[] args)
    String [] cmd = {"top","-bn0q"};
    if (args.length >= 1)
    cmd = args;
    System.out.println(args[0]);
    Exec exec = new Exec();
    exec.run(cmd);
    </code>
    The output of java Exec is:
    [user]$ java Exec
    got runtime
    fired cmd
    prepare error stream
    prepare output stream
    start readers
    waiting for process to end
    OUT: reader runs
    ERR: reader runs
    ...and there it hangs. Interesting is, that when I use ls -als as command, I get the directory listing.
    Do you have any ideas what I am doing wrong? Is there any difference in the Runtime.exec() between 1.3 and 1.4 version?

    Unbelievable and what a shame. I was hacking 2 days on several variations of this problem and the solution and I finally found one difference:
    while (br.ready() && (line = br.readLine())!=null)
    I assume that when executing the command, the output streams are not ready and my Output gobbler threads end.
    ...however the command is still executing and starts to write its output. And as we all know this will overflow the buffer and the process hangs.
    So the final solution is:
    /** catches the output in a parallel thread */
    class StreamReader extends Thread
      String category = null;
      InputStream is;
      StreamReader(String category, InputStream is)
        this.category = category;
        this.is = is;
      public void run()
        try
          System.out.println(this.category+": reader runs");
          InputStreamReader isr = new InputStreamReader(this.is);
          BufferedReader br = new BufferedReader(isr);
          String line = null;
          while (/**br.ready() &&*/ (line = br.readLine())!=null)
            System.out.println(this.category+':'+line);
        catch (Exception e)
          e.printStackTrace();
    }So the only question that I have open: Why does this makes no problem with 1.3 but with 1.4 ?

  • Runtime.exec  problems

    Hi
    I would like to open a chm file from my "help" menu.
    I got two problem related to that:
    1.The first time the menu is clicked i start the process and the help is opened on top of my application frame.
    but - the second time It is opened - the only wat to recognize i sthe process is still active is to call exitValue (if it get an exception - process is still active) but - how can i make the frame on top of my application frame( the current active frame)
    2.when the application is closed the help application does not "die" with the rest of the application.
    I will be happy to get some ideas of how can i control it.
    this is my code:
    Runtime runtime=  Runtime.getRuntime();
            try {
                if(process==null){
                     process=runtime.exec(new String[] {"cmd.exe","/c" , helpLink});
                else{
                    try {
                        process.exitValue();
                        process = runtime.exec(new String[]{"cmd.exe", "/c", helpLink});
                        if (log.isDebugEnabled())
                            log.debug("process finish working");
                    } catch (IllegalThreadStateException e1) {
                        if (log.isDebugEnabled())
                            log.debug("process still working");
            } catch (IOException e1) {
                if (log.isErrorEnabled()){
                    log.error("could not open help file"+ helpLink);
                    log.error("exception:",e1);
                WorkingAreaManager.getWorkingAreaManagerInstance().displayErrorMessage(COULD_OPEN_HELP);
            }thanks,Liat

    1.The first time the menu is clicked i start the
    process and the help is opened on top of my
    application frame.
    but - the second time It is opened - the only wat to
    recognize i sthe process is still active is to call
    exitValue (if it get an exception - process is still
    active) but - how can i make the frame on top of my
    application frame( the current active frame)Sorry I don't know the answer to that. What happens if you invoke it a second time... does it bring up a completely new frame?
    2.when the application is closed the help application
    does not "die" with the rest of the application.
    I will be happy to get some ideas of how can i
    control it.process.destroy()?

Maybe you are looking for

  • How do I re-connect my digital persona?

    The upgrade that messed up my audio mute button also disconnected my digital persona..Finger print reader..Any suggestions on how to get this up and running again?  Hopefully someone can help me with this...Thanks.

  • HT1848 why can't I transfer songs from my itunes account to my ipod?

    On my computer I have tons of songs on Itunes, how can I transfer those songs to my Ipod? I have already sync my Ipod. I also owe money to itunes, could that be the reason why I can't transfer purchased songs and burned songs from cds to my ipod?

  • Keyboard shortcuts for text editing [Home-End]

    Greetings. Is there a way for me to change the text navigations keys in OSX for mapings that would react like any other Linux/windows system ? for example pressing the end button brings me to the end of the document instead of the end of the line...

  • Using Adobe Thai Font in InDesign

    Hi I am having trouble with using Adobe Thai Font on text copied from PDF into InDesign(CS3). When typing with Adobe Thai Font in InDesign it shows as a 'normal' font like Arial. When copying from PDF to InDesign the text appears as glyphs almost lik

  • Invalid byte 2 of 3-byte UTF-8 sequence error

    I'm writing a java program that accesses an XML file and do some computation on it. The problem is that the program works on small sample XML files, but when trying to work with big XML files (which was generated by other program) I get "Invalid byte