Where can I find the description of the codes returned by exitValue()?

Hi Everybody,
I have a java porgram on HP/UX and this program executes the OS level commands and exe file on HP UNIX. When I supply "/usr/bin ls -l" as a param to this program it executes it very well.
But if I pass the "/utils/Myapp/app arg1 arg2" as a parameter it returns some non zero codes
I tried several ways to make it work and I even harcoded the "/utils/Myapp/app arg1 arg2" in the program but it never executes it properly and I got the following return Code return by exitvalue() during my hit and trial method.
255,17,15,12
Does any one have clue what are they.
Note: When I executes /utils/Myapp/app arg1 arg2" from the UNIX prompt it works fine
The java program is given below.
Pl help
Thanks
Yatsomy.
This is my first program in JAVA.
import java.lang.Runtime;
import java.lang.Process;
import java.io.IOException;
import java.lang.InterruptedException;
class executecmd {
public static void main(String args[]) {
System.out.println("In main");
try {
/* Execute the command using the Runtime object and get the
Process which controls this command */
Process p = Runtime.getRuntime().exec(args[0]);
/* Use the following code to wait for the process to finish
and check the return code from the process */
try {
p.waitFor();
/* Handle exceptions for waitFor() */
} catch (InterruptedException intexc) {
System.out.println("Interrupted Exception on waitFor: " + intexc.getMessage());
System.out.println("Return code from process"+ p.exitValue());
System.out.println("Done executing");
/* Handle the exceptions for exec() */
} catch (IOException e) {
System.out.println("IO Exception from exec : " + e.getMessage());
e.printStackTrace();

1. exitValue() codes are the numeric codes returned by native applications you're calling: the meaning of this code is both application and platform dependant (it has nothing to do with java), so you should try to find those info in "app" documentation, or in HP Unix standard docs.
2. I think you'd better "debug" the Runtime.exec() behaviour by capturing stdout and especially stderr of the spawned process: doing so, you will be able to see error messages printed out by called applications or commands...
It's very simple using this small class:
/** connects I/O streams, just like a pipe :-)
* @author: Giorgio Maone
class Pipe {
private InputStream in;
private OutputStream out;
public Pipe(InputStream in, OutputStream out) {
   this.in=in; this.out=out;
public void connect() {
   new Thread() {
    public void run() {
     try {
      for(int b;(b=in.read())!=-1;) {
        out.write(b);
      out.flush();
    } catch(IOException ex) {}
  }.start();
}So you can do this:
Process p = Runtime.getRuntime().exec(args[0]);
new Pipe(p.getInputStream(),System.out).connect();
new Pipe(p.getErrorStream(),System.out).connect();
new Pipe(System.in,p.getOutputStream()).connect();
try {
System.out.println("Exit code: "+p.waitFor());
} catch(InterruptedException ex) {}If you want to use a "smart wrapper" on Runtime.exec(), feel free to use my MultiExec class:
/** executes multiple commands in one shell
* @author: Giorgio Maone
import java.io.*;
public class MultiExec {
static final boolean IS_WIN=System.getProperty("os.name").toLowerCase().indexOf("win")==0;
protected String shell=IS_WIN?"":"sh";
public void setShell(String s) {
   shell=s;
public String getShell() {
   return shell;
public Process exec(String cmds[]) throws IOException {
  File f=File.createTempFile("muexec",".bat");
  PrintWriter out=new PrintWriter(new FileWriter(f));
  if(IS_WIN) out.println("@echo off");
  for(int j=0,len=cmds.length; j<len; j++)
    out.println(cmds[j]);
  out.close();
  f.deleteOnExit();
  return Runtime.getRuntime().exec(shell+" "+f.getCanonicalPath());
public int execAndWait(String cmds[]) throws IOException {
   Process p=exec(cmds);
  new Pipe(p.getInputStream(),System.out).connect();
  new Pipe(p.getErrorStream(),System.out).connect();
  new Pipe(System.in,p.getOutputStream()).connect();
  int exitCode=-1;
  try {
   exitCode=p.waitFor();
   } catch(InterruptedException ex) {}
  return exitCode;
static class Pipe {
   private InputStream in;
  private OutputStream out;
  public Pipe(InputStream in, OutputStream out) {
    this.in=in; this.out=out;
  public void connect() {
    new Thread() {
     public void run() {
      try {
       for(int b;(b=in.read())!=-1;) {
         out.write(b);
       out.flush();
     } catch(IOException ex) {}
   }.start();

Similar Messages

  • The InitCVIRTE function is not listed in the NIDAQ function reference online help? Why? and where can I find a description of this function?

    the InitCVIRTE function is not listed in the NIDAQ function reference online help? Why? and what does she do?and where can I find a description of this function? Can i use this function with visualc++ 6.0?

    The InitCVIRTE function is in the CVI run time engine (cvirte.dll)..not part of NI-DAQ.
    Applications written or using CVI may call this function..
    How are you running into this ?
    From the CVI help...
    This function performs initialization of the CVI Run-Time Engine. It is needed only in executables or DLLs that are linked using an external compiler. Otherwise, it is harmless.
    It should be called in your main, WinMain, or DllMain, function. The parameter values you should pass depend on which of these three functions you are calling InitCVIRTE from. The following examples show how to use InitCVIRTE in each case.
    If you are using main, your code should be as follows.
    int main (int argc, char *argv[])
    if (InitCVIRTE (0, argv, 0) == 0)
    return -1; /* out of memory */
    /* your other code */
    return 0;
    If you are using WinMain, your code should be as follows.
    int __stdcall WinMain (HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpszCmdLine,
    int nCmdShow)
    if (InitCVIRTE (hInstance, 0, 0) == 0)
    return -1; /* out of memory */
    /* your other code */
    return 0;
    If you are creating a DLL, you must call InitCVIRTE and CloseCVIRTE in your DllMain function, as in the following.
    int __stdcall DllMain (void *hinstDLL, int fdwReason,
    void *lpvReserved)
    if (fdwReason == DLL_PROCESS_ATTACH)
    if (InitCVIRTE (hinstDLL, 0, 0) == 0)
    return 0; /* out of memory */
    /* your other ATTACH code */
    else if (fdwReason == DLL_PROCESS_DETACH)
    /* your other DETACH code */
    CloseCVIRTE ();
    return 1;
    NOTE: The prototype for InitCVIRTE is in cvirte.h, not
    utility.h.
    NOTE: In CVI 4.0.1, this function was expanded from one to
    three parameters. Executables and DLLs that were
    created using the one-parameter version of the function
    will continue to work properly.
    /*-------------------- Prototype ---------------------*/
    int InitCVIRTE (void *HInstance, char *Argv[], void *Reserved);
    Nandan Dharwadker
    Staff Software Engineer
    Measurement Studio Hardware Team

  • Where can I find a description of what the Windows APIs do , such as NIDAQErrorHandler?

    I would like to know how to use these Windows APIs, where can I find a description?
    thanks

    Check this post here
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • Adobe starter edition has photo numbers by the picture such as DSCO0283.JPG , where can I find that number on the pictures in PHOTOSHOP ELEMENTS 12--reason being that photoshop elements will not convert my catalog to version 12. If i had that number I cou

    adobe starter edition has photo numbers by the picture such as DSCO0283.JPG , where can I find that number on the pictures in PHOTOSHOP ELEMENTS 12--reason being that photoshop elements will not convert my catalog to version 12. If i had that number I could manually rebuild my collections into the photoshop elements 12, but all that i see in photoshop elements is dates and i have multiple pictures from the same dates. HELP! I

    finally getting back to this project---adobe starter edition 3.2 is on a windows XP computer
    ADOBE PHOTOSHOP ELEMENTS 12 is on our Windows 8.1 computer.
    error messages--- had to give up trying to convert---I copied all our pictures to our windows 7 laptop and I installed adobe photoshop elements 12 (my bought program)
    I wanted to try to convert there first. also I copied our catalog to this computer also. Everything was working fine I could see the collections just as they where on the XP computer.
    then I tried to convert on the laptop. I believe the error said something about corrupt file, so I gave up that day. Next day I tried to open ADOBE STARTER EDITION 3.2  and it wanted an unlock code, no such code exists. and my copy of Elements 12 turned into a trial version which has expired. So I am a little hesitant to try to convert on the XP  computer and mess up the existing catalog,
    unless there is a fool proof way. I have tried manually making collections/ albums on Windows 8.1 and PHOTOSHOP ELEMENTS 12  and coping pictures into the new albums. sloooow!!
    I probably have about 4500 pictures and 150 collections/ albums to go. So any suggestions would be appreciated.

  • Where can i find a pdf with the dutch version of the manual for lightroom 6

    where can i find a pdf with the dutch version of the manual for lightroom 6

    I don't think it's available yet.  The English help page has a link to it:
    https://helpx.adobe.com/lightroom/topics.html
    But the equivalent page for Netherlands only links to prior versions:
    Help bij Lightroom | Help bij Lightroom
    Same for DE, FR, ES.  Maybe someone more enlightened knows if they're available somewhere else on Adobe's site.

  • HT1732 Where can I find a download of the Mac OS 9.2.2?

    Where can I find a download of the Mac OS 9.2.2?

    Hi, legally nowhere.
    Certain Mac models require special OS9 Install discs, REtail OS9 Discs work on otheres...
    http://www.ebay.com/sch/sis.html?_nkw=MAC%20OS%209%20Install%20CD%20Featuring%20 Sherlock%202&_itemId=320299632746

  • Where can I find in this store the invoice of the purchase I did?

    Where can I find in this store the invoice of the purchase I did?

    a purchase for what type of product? Computer, App, iPhone??

  • Where can I find a mapping of the Mac Powerbook version number (e.g., 3.1) to the dates (e.g., "late 2007") that Apple uses for indicating compatibilty with OS upgrades?

    Where can I find a mapping of the Mac Powerbook version number (e.g., 3.1) to the dates (e.g., "late 2007") that Apple uses for indicating compatibilty with OS upgrades?

    There were no PowerBooks made in 2007. By then Apple had switched over to Intel and they were making MacBook instead.
    If the MacBook is what you really want try http://en.wikipedia.org/wiki/MacBook
    Allan

  • My iLife v9.03 Install disk is corrupt. Where can I find a download for the the app (not update) at apple support online ?

    My iLife v9.03 Install disk is corrupt. Where can I find a download for the the app (not update) at apple support online ?

    I have an iLife 11 disc that doesn't work very well so I tried creating a disk image of it with Disk Utility.  It took two tries but finally got a disk image that I could use to install the iLife 11 applications. Give it a try.
    OT

  • Where can I find a list of the meaning of the symbols that can appear in the headline at the top of the screen on the ipad and iphone?

    where can I find a list of the meaning of the symbols that can appear in the headline at the top of the screen on the ipad and iphone?

    http://support.apple.com/kb/HT1558
    http://support.apple.com/kb/TA38663
    http://support.apple.com/kb/HT4982
    They are also listed in the built-in User Guide accessible directly on the iPhone in Safari.
    Find the "iPhone User Guide" bookmark, then go to iPhone at a Glance > Status icons

  • Where can I find a list of the 1600 /- instruments included in the new Logic Pro X?

    Greetings,
    Where can I find a list of the 1600+/- instruments included in the new Logic Pro X?
    Thanks all!

    AFAIK, there is no master list. If you have the Silicon Prairie "Tools" utilities, you can compile your own lists. See: Silicon Prairie - FrameMaker Products
    The best approach is to simply use the Copy Special to pick up the paragraph and character styles that you want to add to your new template and build the template piecemeal, i.e. create one FM file for your tables, another for your page layouts/sizes, another for your tags, cross-refs, etc. Then combine those as required to build the final template. This Lego-like approach is much more flexible and allows you to modify base-components and quickly make a new brand new template.

  • Where can I find a copy of the eula for Adobe Acrobat XI?

    Where can I find a copy of the eula for Adobe Acrobat XI?
    The eula does not come up for inspection when you install the software.

    http://www.adobe.com/legal/licenses-terms.html

  • Where can i find my applications on the iMac intel?

    where can i find my applications on the iMac intel?

    Choose Applications from the Finder's Go menu.
    (65360)

  • Where can I find join conditions in the ALL_IV_XFORM views?

    OWB 10.2
    where can I find join conditions in the ALL_IV_XFORM views? And if they cannot be found there, where are they to be found?
    Regards,
    Jaap.

    Hi Jaap,
    ALL_IV_XFORM views are called Mapping Model Views . These are available at repostory owner user.
    ALL_IV_XFORM_MAPS
    ALL_IV_XFORM_MAP_COMPONENTS
    ALL_IV_XFORM_MAP_PARAMETERS
    ALL_IV_XFORM_MAP_PROPERTIES
    ALL_IV_XFORM_MAP_DETAILS
    Connect repository user and execute below statement
    SELECT VIEW_NAME FROM ALL_VIEWS WHERE VIEW_name like 'ALL_%';
    Regards,
    Venkat

  • Is there a way to get a search protocol of the "Find my iPhone" search app and icloud ? And where can i find a protocol of the chat with a apple support worker

    Is there a way to get a search protocol of the "Find my iPhone" search app and icloud ? And where can i find a protocol of the chat with a apple support worker

    Thanks for the reply however this does not help.  When I check the cloud it shows that I have only 20 photos.  In reality I had a lot more than that.  All the photos on the cloud are those that I have taken since I was at the Apple store.  When I check cloud storage usage on my phone it says that I have 5.1 GB of photos.  This is a lot more than the 20 that I can see.  I am not sure what the Apple employee did to my phone.
    Still looking for answers.  It is really too bad that I can not talk to an Apple person to get help since they messed up my phone.

  • HT1386 Is my agenda also synced to my computer and where can I find/check it on the computer?

    Is my agenda also synced to my computer and where can I find/check it on the computer?

    Currently shipping docs are for Oracle Waveset 8.1.1
    http://docs.sun.com/app/docs/prod/sjs.ident.mgr81~1514.7#hic
    You'll probably want to start with the Deployment Guide & Reference to get a feel for the different components.
    Specifically, you're looking for something better than Ch. 5 : XPRESS Lanugage in the Deployment Guide.
    http://docs.sun.com/app/docs/doc/821-0378/bvbps?a=view
    You should review the forms and look for the dependencies of other forms, libraries, rules et al.
    Forms may be used by workflow, the other major XPRESS execution area in Waveset.
    In certain deployments, reusable form components are stitched together with elegance; in others, it's a train wreck of one-use forms that duplicate vast amounts of unreadable code in dozens and hundreds of files.
    Typically, a build procedure is generated to allow you to click forms into a larger project deployment structure. Without knowing what's lying around, it's tough to examine a single file and get an idea for how the object affect the installation...
    The netbeans plugin for Waveset provides easy access to help on many functions and the entire javadoc set for com.waveset, which may have shortcuts you can learn from... especially around building a base project and customizing simple objects.
    If the Identity System Essentials tutorials are still around, they were a good place for template examples...

Maybe you are looking for

  • [Solved] Kernel BUG at include/linux/netdevice.h:501, and sky2?

    So, ever since a certain point in time between kernel 3.11.x and now (3.12.5-1), I have been getting this strangely inconsistent error on bootup. I would estimate that about 3 out of every 4 reboots leads to this error message, and the bootup process

  • How can I keep this from automatically starting up??

    I just installed this and it starts up automatically and i would rather it not, because it also does not shut down when i am trying to close my computer.  how do i do this????  thankis

  • Disk Utility Freezes & MS Word & Excel Won't Launch

    Yesterday, my Disk Utility froze when it started performing a Verify Disk and I had to force quit. This morning I was using both MS Excel and MS Word, closed them and when I tried to open them 30 minutes later, neither will launch and I get an error

  • Creating a scroll bar

    Ok what I have is a site I am building for school.  I have some textfields loaded from a outside file.  Some of the fields have more text then will show in the size of the box, and you can sroll it down to read it all but unless you try to scroll the

  • Error - wrong number or tyeps of argument

    Hi All, I am facing error while passing record type parameter to procedure P2. CREATE OR REPLACE PACKAGE Pkg_test AS v_Bulk_Limit NUMBER := 1000; TYPE Test_Rec IS RECORD( F1 NUMBER, F2 NUMBER, F3 NUMBER); PROCEDURE p1(IN_dt DATE); Procedure p2 (in_ta