Problem with method Runtime.exec()

i wrote this simple line, in a servlet:
Runtime.getRuntime().exec(myCommand);
if i run this servlet in the OC4j included whith jdeveloper all works well...but if i run the same servlet in the Application server, the command is not executed...why????
is it a security issue?
please help me..

Stefano, can you take a look at the application server log files to see if there is any related information that tells what was happening? What is better, can you try catching the standout and standerr of your command as what is done in the following message?
   Re: javac not found on UNIX AIX runnig Oracle AS 9.0.4
Please tell me if you have any new findings then.

Similar Messages

  • UNIX Problem with method Runtime exec(String[],String[],File)

    Hello !!
    i'm french
    scuse my english
    I got a probleme with method exec(String[],String[],File) of Runtime Class
    i don't have any probleme when my program runs on Windows NT but the same program on UNIX doesnt execute my command..
    When i use exec(String[]) methode i dont have this problem ...but i need the second one methode because i have to execute my command in a different directory than the JAVA program.
    I need that results of this command are placed in this drectory so that i can't use an exex() like that :
    exemple with a perl :
    "perl /toto/titi/hello.pl"
    I want to execute this :
    "perl hello.pl" (and hello.pl is placed in /toto/titi)
    Conclusion :
    the exec(String[],String[],File) solution is ok with NT ...
    but with UNIX ????
    Is there other solution ??
    Should i do a "cd" command before my execution ? how can i do this ??
    Thanks !!!!

    Could you post your source code (only relevant part)
    Raghu

  • Problem in using runtime.exec()

    Hi all,
    I am having a problem with the runtime.exec method.I am trying to execute linux commands using this method.For most of the commands it works fine.But when i tried to change the user with the su command in linux my program hung up.So please help me to get around this.any help would be highly appreciable..
    I am pasting the code..
    <code>
    Process p=null;
    int ch=0;
    try
    System.out.println("Before executing command");
    String unlock_command="sh changeuser.sh";
    p = Runtime.getRuntime().exec(new String[] {"/bin/sh","-c","su tony"});
    InputStreamReader myIStreamReader = new InputStreamReader(p.getInputStream());
    while ((ch = myIStreamReader.read()) != -1)
    System.out.print((char)ch);
    p.waitFor();
    int p_exitvalue = p.exitValue();
    System.out.println("After executing the command and the exit value = "+p_exitvalue);
    p.destroy();
    catch (IOException anIOException)
    System.out.println(anIOException);
    catch(Exception e)
    e.printStackTrace();
    </code>
    Thanks
    HowRYou

    Is it possible that this is a re-post of this thread?
    http://forum.java.sun.com/thread.jspa?threadID=636637
    :^)Might be! What gives you that impression?

  • Problem of using Runtime.exec() to run .bat

    hi,
    i try to rum a .bat in the following way:
    Runtime runtime = Runtime.getRuntime();
    Process proc=runtime.exec("cmd.exe /c c:/test.bat");
    int exitVal=proc.waitFor();
    System.out.println("exitVal: "+exitVal);
    but it doesn' t work...
    ,and i get a exit value '1'
    what dose it mean?

    hi,
    i try to rum a .bat in the following way:
    Runtime runtime = Runtime.getRuntime();
    Process proc=runtime.exec("cmd.exe /c c:/test.bat");if it is already a .bat file, why do you invoke it with cmd.exe?? try running it directly as
    Process proc=runtime.exec("c:/test.bat");

  • Any problems with labview runtime v 7.1 on one host interacting with lvrte 6.1 on another host?

    Using OPC, UDP ant TCP on the host running lv 7.1 runtime, communicating with a second host running lvrte 6.1. Both hosts communicating with cpfp 2020 and using similar IAK files. Need to know if there are any known problems with this scenario. I cannot convert st this time, the legacy 6.1 side.

    Hello,
    Thank you for contcting National Instruments.
    I am not sure I understand your question. The LabVIEW Run Time Engine (LV RTE)is used when you will be running an executable on a target. If you want to run executables on your cFP-2020 that were built in LV 6.1 and 7.1, you will need to make sure that LV RTE 6.1 and 7.1 are installed on the cFP 2020.
    If you wish to run VIs (not executables) targeted to your cFP-2020, you can use LabVIEW Real-Time 6.1 or 7.1, but not both.
    Let me know if you have further questions.
    Sean C.
    Applications Engineer
    National Instruments

  • Problem with Method environment_get_variable (Windows GUI)

    Hello,
    I want to use the Method "cl_gui_frontend_services=>environment_get_variable".
    I try this coding with same keywords ('%TMP%', 'TMP', ...), but the result is ever sy-subrc = 0 und s_path is initial.
    DATA s_path TYPE string.
          CALL METHOD cl_gui_frontend_services=>environment_get_variable
            EXPORTING
              variable             = 'USERPROFILE'
            CHANGING
              value                = s_path
            EXCEPTIONS
              cntl_error           = 1
              error_no_gui         = 2
              not_supported_by_gui = 3
              OTHERS               = 4.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno
                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    Please, can every body tell what is wrong.
    Thanks

    hi,
    seems to be a problem with java environment...
    see link and note
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_bc_fes/~form/handler%7b5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d31303237303133%7d]
    take a look at the env-variable:
    QTJAVA=d:Javajre1.5.0_11libextQTJava.zip
    and try to change it to older relase (1.4!)
    Bye

  • Remote Debug problem with CVI Runtime Versions.

    Development Platform - CVI Version 8.5.1
    Target has DAQmx 9.4 installed on it along with CVI Runtime Engine ver: 9.1.0.428
    Developmenrt Platform was recently upgraded to DAQmx 9.4
    Re-installed CVI RTE (ver 9.1.0.428) on Development Platform - even though it was already installed.
    I keep on getting this error message on the Target system "The LabWindows/CVI Run-Time Engine on the target is more recent than your Lab Windows/CVI environment.  You have to upgrade the Lab/Windows environment if you want to debug your application."
    Both systems (Development Platform & Target) have the same versions of CVI RTE and DAQmx.  I have done a complete re-compile of the application .exe that I am trying to excute on the Target.  I have re-installed CVI RTE on the Development Platform.
    What is wrong here? 
    Solved!
    Go to Solution.

    LabWindows/CVI Environment == Development platform.
    I.e.: you must either downgrade the runtime engine on your target to match the existing 8.5.1 of the debugging machine or upgrade CVI installation on the development machine to match the 9.1 on the target (if I'm not wrong 9.1 means CVI 2009 SP1). The two machines must have the same version or the debugging machine must be more recent than the target one.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Not able to open windows application With Java Runtime .exec class

    Hi,
    We have created a folder with mkdir() function. The folder has some
    text and doc files and i want to open them using java runtime API.
    I am unable to open the files using the syntax
    try {
    Process p=Runtime.getRuntime().exec("cmd /c \ "" + file.getPath());
    p.exitValue();
    catch(Exception e)
    e.printStackTrace();
    This code works perfectly for folders created directly in Win XP without using
    mkdir.
    Also the return values of of class Process is 1 which we understood as illegal thread state. But I still havent got a clue how to fix it.
    Appreciate quick feedback :) Thanks ;)

    First off you're missing a quote (add '+ "\"" after file.getPath()). But the larger problem is that this will attempt to execute these files and they aren't directly executable (you said they're text and document files). Do you really want to execute them?
    If you just want to read them then something like
    BufferedReader ir = new BufferedReader(new FileReader(file))
    would be more appropriate.

  • Problem with method action after migrating from TP2 to TP4

    Hi,
    we are migrating our application (ADF Faces, ADF BC) from TP2 to TP4. We have encountered several problems.
    The biggest that we could not solve is as following:
    In our View Object's RowImpl.java classes we have method void refreshLOVAccessorQueries(). In a number of View Objects that method is placed in client interface. In pageDefs of jspx pages that are bound to that View Objects we have method action like
    <methodAction IterBinding="TeeCronTtVOIterator"
    id="refreshLOVAccessorQueriesCron"
    InstanceName="bindings.TeeCronTtVOIterator.currentRow"
    DataControl="TradingAppModuleDataControl"
    RequiresUpdateModel="true" Action="invokeMethod"
    MethodName="refreshLOVAccessorQueries"
    IsViewObjectMethod="false" IsLocalObjectReference="true"/>
    and invoke action like
    <invokeAction id="refreshCronLOVs" Binds="refreshLOVAccessorQueriesCron"
    Refresh="prepareModel"
    RefreshCondition="#{!requestContext.postback and empty bindings.exceptionList}"/>
    When we are accessing such a jspx page the application rases error:
    "Method bindings.TeeCronTtVOIterator.currentRow.refreshLOVAccessorQueries() not supported "
    In TP2 everything worked fine. Now in TP4 for some VO that refresh is OK and for others just mentioned error is thrown. Confusing is that all View Objects and their java classes are created in the same manner and they are almost identical, and this counts for pageDefs too.
    What could be the reason of all this?
    Second thing is that in adfc-config.xml in backing bean defs we have managed-property like:
    <managed-bean>
    <managed-bean-name>regionBacking</managed-bean-name>
    <managed-bean-class>app.view.backing.RegionBacking</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>bindings</property-name>
    <value>#{bindings}</value>
    </managed-property>
    </managed-bean>
    JDeveloper warn us about that with: ' EL token bindings" is unknown '. Why is that? It looks that everything connected with that managed property works fine.
    Another problem is not severe but unpleasant
    After migration to TP4 nothing (not one element) is visible (shown) in the design view.
    The structure of the pages is similar as in the StoreFrontDemo and it shows just fine in TP2.
    Thanks!!!

    Thanks Frank,
    but working from beginning is to much work so, we have solved it in another way.
    Regard to first problem we discovered that it is happening only when there is no Rows in iterator for which we are invoking action. In invoke action we have changed refresh property to default value and the problem is solved.
    Second thing is warning that has no other effect so we will ignore it.
    About third problem, when we create new working copy of application in JDeveloper without system11.1..... directory, JDev works fine and all jspx pages are shown in design view. After some work, due to undiscovered reason design view is lost... What could cause this?
    Maxa

  • Problems with J2SE runtime enviromen 5.0 update 6

    i uninstalled it but it will not leave my add/remove program area
    i tried to reinstall it and i get this:
    the installation of package http://java.sun.com/update/1.5.0/jre-1_5_0_06-windows-j586.xp:failed with-203
    i go to try to remove it from the add/remove programs and i get this
    error applying transforms. verify the specified transform paths are valid
    i can install the 1_5_0_08 and it seams to be working fine for now but im wonder what problems the _06 will cause by sticking around where ever it seams to be hiding

    Updates for J2SE Runtime Environment 5.0 ? Can old updates be REMOVED
    Aug 27, 2006 3:56 PM
    i'm on XP Home SP2 and trying to clean up my computer. I recently installed Internet Explorer 7 Beta. Subsequently i received an error message that lead me to download something from the Java website. I'm not sure it was really necessary but i guess i'll keep it.
    Browsing through Add/Remove Programs i see two Java programs identical except one is version 6 the other is version 8. Both are 119MB. Can i remove/delete version 6 or do all the updates need to remain installed on my computer?
    Thank you,
    [email protected]

  • Problem in executing RunTime.exec() commands

    Hello EveryBody
    I have a problem.i have to zip the photos that r uploaded by the users and sumit it to the lab person.for that i zip these photos and give the lab person to download that zip.
    But the problem is that when ever i zip 30 to 40 photos its work fantastic.but more the 50 photos not get zip.I have used the code as follow.
    // Here tr=ru
    //dest=distinaction path of the file
    // src=source path of the file
    try
         Runtime rt = Runtime.getRuntime();
         String [] cmd={"zip",tr,dest,src};
    Process p2=rt.exec(cmd,null,dir2);//
         p2.waitFor();
    }catch(Exception e2){
    out.println("HOTO EXCEPTION "+e2.toString());
    Since no zip file is created for big size photo and also it not shows any error.can anybody help me it is urgent.
    Thanks a lot
    R

    zip reports the files as it progresses. It this report is too long, zip's outpbut buffer gets filled and if you do not read it from your Java program, zip will block.

  • Problem In Executing Runtime.exec().....(:

    Dear All,
    I want to execute the java program which calls the subclasses. The output of the subclasses should be displayed on different MSDOS-Window Consoles. For this i am using the following piece of code....
    Process proc=Runtime.getRuntime().exec("cmd /c start /k java test.SubClass1");
    But I am not able to see different Consoles, though it had created the new process and excuted the program.
    My O.S Environment is Win2000 and the java version is 1.4
    Advance TX for the suggestion given...
    Regards,
    Saradhi.

    Saradhi,
    I can't test on win2000, but I tested on XP and the code I send you will actuall open a new console window ("dos shell"), as you requested. Maybe you would like to test it too. I'm pretty certain it will work on NT and win2000 as well. It won't work on win98, however, since you'd have to use "command" instead of "cmd" there - or was this win95? My memory is fading.
    By the by, have you considered to run the java programs you mentioned in the same virtual machine as your calling program, by simply calling the main method?
    Cheers, HJK

  • Problem with method "write" in POI Library.

    Best regards, I have the following problem: I have a application in Oracle BPM 10g, that generates a file in Excel. First it upload a template, then query the data base, and storage this data in "POI Object" of type "XSSFWorkbook"; all of the this, at memory.
    The problem is when I try to write this object  "XSSFWorkbook", in the file(generate a Physical File), the file size is about 35 MB, usgin the method wb.write(out) of the "POI Library", my server spend about 15  minutes, generating blocks.
    I' like that some help me to solve this problem, maybe making any setting in my server.
    My Servers are:
    Application Server: Oracle WebLogic 10.3.1
    and File Server: Oracle Linux. Memoy: 32GB
    I show you the code in java:
                rsQuery = generarTablas(sStoredProcedure,xmlTableroControl);
                InputStream inp = JExcel.cargarPlantillaLectura(sRutaOrigen + sNombreOrigen + ".bck");
               XSSFWorkbook  wb = new XSSFWorkbook(inp);  //DESCOMENTAR
              wb.setForceFormulaRecalculation(true);
                int vnHoja = 0;
                String vsTabla = "";
                while(rsQuery.next()){
                    vnHoja  = rsQuery.getInt(1);
                    vsTabla = rsQuery.getString(2);
                    outResultado = new BufferedWriter (new FileWriter("/tmp/"+String.valueOf(nOrden)+vsTabla+".txt"));
                    outResultado.write("vsTabla: "+vsTabla+" Hoja : "+String.valueOf(vnHoja)+  "\n"+String.valueOf(Util.getTodayTime()));
                    outResultado.close();
                  nOrden ++;
                    this.rsConsulta = consultar(vsTabla);
                  if(_getRowCount(this.rsConsulta)>0)
                        generarHoja(wb, 6, vnHoja);
                        this.rsConsulta = null;//agregado 12/06/2013
                 File tempFileXLS = File.createTempFile(sNombreDestino + this.sFechaFin + "_", ".xlsx");
                ruta = sRutaDestino + tempFileXLS.getName();
                OutputStream out = new FileOutputStream(ruta);
                inp.close();
                wb.write(out);//---------------------> PROBLEM

    Best regards, I have the following problem: I have a application in Oracle BPM 10g, that generates a file in Excel. First it upload a template, then query the data base, and storage this data in "POI Object" of type "XSSFWorkbook"; all of the this, at memory.
    The problem is when I try to write this object  "XSSFWorkbook", in the file(generate a Physical File), the file size is about 35 MB, usgin the method wb.write(out) of the "POI Library", my server spend about 15  minutes, generating blocks.
    I' like that some help me to solve this problem, maybe making any setting in my server.
    My Servers are:
    Application Server: Oracle WebLogic 10.3.1
    and File Server: Oracle Linux. Memoy: 32GB
    I show you the code in java:
                rsQuery = generarTablas(sStoredProcedure,xmlTableroControl);
                InputStream inp = JExcel.cargarPlantillaLectura(sRutaOrigen + sNombreOrigen + ".bck");
               XSSFWorkbook  wb = new XSSFWorkbook(inp);  //DESCOMENTAR
              wb.setForceFormulaRecalculation(true);
                int vnHoja = 0;
                String vsTabla = "";
                while(rsQuery.next()){
                    vnHoja  = rsQuery.getInt(1);
                    vsTabla = rsQuery.getString(2);
                    outResultado = new BufferedWriter (new FileWriter("/tmp/"+String.valueOf(nOrden)+vsTabla+".txt"));
                    outResultado.write("vsTabla: "+vsTabla+" Hoja : "+String.valueOf(vnHoja)+  "\n"+String.valueOf(Util.getTodayTime()));
                    outResultado.close();
                  nOrden ++;
                    this.rsConsulta = consultar(vsTabla);
                  if(_getRowCount(this.rsConsulta)>0)
                        generarHoja(wb, 6, vnHoja);
                        this.rsConsulta = null;//agregado 12/06/2013
                 File tempFileXLS = File.createTempFile(sNombreDestino + this.sFechaFin + "_", ".xlsx");
                ruta = sRutaDestino + tempFileXLS.getName();
                OutputStream out = new FileOutputStream(ruta);
                inp.close();
                wb.write(out);//---------------------> PROBLEM

  • Problem with method just cannot get it to work

    hi. i got a problem in this part of my program. i am to read in a text file and store it in the arrys before printing it out.but i cannot get the file to be read into the array and to be printed out correctly.
    my text file to be read in is something like this:
    Question0
    what is your name
    a: nick
    b: john
    c: peter
    d: jane
    c
    Question1
    what is your most prefered colour
    a: red
    b: blue
    c: green
    d: yellow
    a
    but when i run the code i have written it keeps printing out like this:(excally what is printed out). the entire order is being messes but with no "questionO" which there should be and the "what is your name question being repeated twice, and the second time without the answer.
    what is your name
    a: nick
    b: john
    c: peter
    d: jane
    c
    what is your name
    a: nick
    b: john
    c: peter
    d: jane
    Question1
    what is your most prefered colour
    a: red
    b: blue
    c: green
    d: yellow
    a
    please can you advice me if in any part of this i have gone wrong, and what should i do to solve the probelm. i really need this help thanks.
    my code is:
    static int questionIndex = 0;
    static int mainMenuOption = 0;
    static String []question = new String[20];
    static String []answer = new String[20];
              do {
                   mainMenu();
                   mainMenuOption = Console.readInt("Enter Choice(1-3) :");
                        if (mainMenuOption==2)
                             takeTestOption();
              } while (mainMenuOption!=3);
              public static void mainMenu() {
                   System.out.println("2.Take Test");
                   System.out.println("3.Quit");
                   System.out.println("");
    public static void takeTestOption(){
                        readInQuestion();               
                   public static void takeTestOption(){
                   //     mainMenu();//prints out the menu options to be entered by the users
                        readInQuestion();
                        //printingOutQuestion();               
                   public static void readInQuestion() {
                        String fileName = "apple.txt";
                        FileIn readInFile = new FileIn(fileName);
                        String readInFileText = readInFile.readString();
                        String finalText= "";
                             if(readInFile.getReadStatus() != readInFile.FILE_NOT_FOUND){
                                   while (readInFile.getReadStatus() != readInFile.EOF ){
                                        while (readInFileText.length() !=2) {
                                            finalText = finalText+readInFileText;
                                            readInFileText = readInFile.readString();
                                       question[questionIndex]=finalText;
                                       if (readInFileText.length()==2) {
                                            answer[questionIndex] = readInFileText;
                                       questionIndex++;
                                       readInFileText = readInFile.readString();
                                        printingOutQuestion();
                   public static void printingOutQuestion() {
                        for (int index=0;index<questionIndex; index++){
                             System.out.println(question[index]);
                             System.out.println(answer[index]);
                   }

    You are using a class that was supplied by the teacher (FileIn). This is a class that none of us knows about. If it is small, it would be useful to post that as well.

  • Funny Problem with method GET_GROUPED_COLUMNS

    Hi All,
    I am encountering a funny problem. I need to provide all Grouped Columns of my Web Dynpro Table. I used the following coding to do this:
    lt_col_grp = lo_table->get_grouped_columns( ).
    Now, for one table this methode return all Grouped Columns and for another table it returns not only the Grouped Columns, but also the NON Grouped Columns!!!
    In the debugger this looks as follows:
    1     *->{O:1752*\CLASS=CL_WD_TABLE_COLUMN}*
    2     ->{O:1755*\CLASS=CL_WD_TABLE_COLUMN_GROUP}
    3     ->{O:1757*\CLASS=CL_WD_TABLE_COLUMN_GROUP}
    4     ->{O:1759*\CLASS=CL_WD_TABLE_COLUMN_GROUP}
    5     ->{O:1761*\CLASS=CL_WD_TABLE_COLUMN_GROUP}
    6     ->{O:1763*\CLASS=CL_WD_TABLE_COLUMN_GROUP}
    7     ->{O:1765*\CLASS=CL_WD_TABLE_COLUMN_GROUP}
    Why is that??
    Does anybody know how to delete the lines that are not of type CL_WD_TABLE_COLUMN_GROUP?
    Thanks,
    Johannes

    Hi Maik
    It seems you have solved your problem. There are some actions clearing all selection and scrolling info. And since you every time create a new instance or call some method which clears your selections your selections table is lost.
    For a screen session, you should use "set_table_for_first_display" for just once and for next PBO triggers you should execute the method "refresh_table_display".
    *--Serdar

Maybe you are looking for

  • MacBook covered in water! Will it survive?

    I don't usually use online discussion boards to answer my questions but i need a lil quick smart advise/reassurance... this morning when i was getting ready for the day something terrible happened. I was tidying my room when i placed my laundry bag b

  • The new U2 album that I never asked for keep playing on my Ipad, how do I get rid of it ? seems to come from the iCloud....

    need to delete this album from my ipad... icons of iCloud on the right of the songs. the album appears under artists doesn't appear on lists doesn't appear on the Imac when Ipad connected ? how do I suppress this music I don't want ?

  • OS X Leopard installation hangs with about 24 mins left! Please help!

    I was prepping my iMac (Intel) for resale, so after backing up my data, I booted up with the Mac OS X Installation Disc (1 of 2). Before proceeding with the installation I went to Disk Utilities and ran a 7-pass erase of my HD. After erasure was comp

  • The Security Problem of RMI-Applet?

    Hi, I used jdk1.3, Apache Jserv as the environments. Then I downloaded helloWorld sample from java. sun.com and wanted to make it work in Java Applet. It runs ok with HelloClient.java. However, there are errors when with HelloApplet.java: HelloApplet

  • Max Runtime In Dialog

    Hi All, In one of my SAP server having maximum dialog run time (rdisp/max_wprun_time) is 1300 Secs and the same value is applicable for every users who all are running in dialog mode. Can we increase this value only one or two users( let say this two