Ho to execute dbschema command in jsp

hi
i am using informix as database server.In that dbschema is a utility that gives schema of table
This command i have to excecute in jsp but i dont how?

hey. Im actually using servlets and i know this isnt the right forum but i was given this url to come look here as it is similar to something i need.
I just need to execute a batch file that sync's down a load of files and directories from perforce. i dont need to print them or see them i just nned it down so im assuming i will need more than just
Process p = Runtime.getRuntime().exec("C:\\sync.bat");
at the top of my code to run the batch file. does anyone have any idea what else i will need.

Similar Messages

  • Execute Linux Command via JSP

    How can I execute Linux commands through a JSP page on a Red Hat Linux 6.1 Machine using Tomcat 3.0
    Please Mail your answer
    [email protected]

    Hi Nick,
    Thankx a lot, for suggestion,
    I wanted to make a page which gives me a text box to write a command and below it shows the result of that command,
    Say , I m in directory "/home/dhiraj"
    and I write in command text box : "pwd"
    it should give me the currrent path in result , which I can show in form of HTML as Results ,
    (may be in a String form..)
    same way if I write in command box : "ls -l"
    it should Return me (say a String) the directory listing of the current path in result,
    I have already tried the Runtime & Process class ,
    Runtime rt = Runtime.getRuntime();
    Process p =null;
    p = rt.exec("command here");
    p.waitFor();
    it has following problems:
    1) This way I m not able to get the result ..
    2) I tried to make a zip file via my program it did not threw any exception , but could not execute...
    I was confused is it 'coz of permission ( rights problem) or some programmatical error as the same program runs via a Java Class file ..
    desperately waiting for ur suggestions
    Dhiraj Agrawal
    MCA student and a Trainee in a local Software House
    reply to: [email protected]

  • Need to execute Linux Commands in JSP

    Hi I am Srinivas,
    I am new to this forum,
    {color:#ff0000}I want to execute Linux Commands(which is remotely connected through putty) in a JSP Page.{color}
    {color:#0000ff}My requirement is to display df -h output on a JSP page.{color}
    This is because we will monitor disk space at regular intervals.
    Can anyone help me in this regard.
    Thanks & Regards
    Srinivas V.
    Edited by: Srini-XIUS on Mar 24, 2008 2:06 AM

    I think you might need the java 'robot' class.
    However, a JSP page displayed on a browser is running in a secure enviornment that will probably not let you access the computer its running on. Instead, create a serlvet back on the server that runs the robot class. The servlet will send the data to the jsp page for display. The jsp page can send commands to the servlet which will execute it via its robot class.

  • Executing javascript command in jsp method

    here's the situation....
              I have a jsp page with three buttons at the bottom. One button reads
              "Save and Continue", another reads "Save and Quit" and the third reads
              "Quit". OnClick the page executes a java method that does
              verification for form objects, etc. THe problem here is the only way
              I know to close a window is self.close(); in javascript.
              Does anyone know how I may be able to excecute the method on click and
              then have that method close the window? IS this possible?
              

    No, I was not getting an error, but the file that I was executing was suppose to create two files and the two files were not created.
    However, I have since discovered that I needed to have write permission on the directory that I was writing too. So, it is working now, but thanks for responding.

  • Executing batch File from Jsp

    I want to execute a batch file which is located at d:\build from a jsp
    I also want to give parameters to batch file.
    Actually my batch file is demo.bat and i want to execute this command via jsp
    demo Compile dev

    in a word - don't. that's not what jsps are for.
    you sound confused about where jsps actually run. get client and server straight in your head and then think about it again.
    %

  • Executing "at" command of UNIX through JSP

    Friends,
    1. "at" command in UNIX execute Unix command at a scheduled time. 2. For each user there will be a table maintained internally which can be accessed by "at" with "-l" argument.
    3. A mail will be sent to the owner with the output of the commands as a message.
    I tried to run the "at" command of Unix in JSP, which gets succesfully executed in Oracle 10g App Server container (Installed in Solaris machine). I have tested the successful execution of command with the log file. But I haven't got any mail for the output. If anyone had any idea, please help me.
    The code I have wtitten is
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(new String[] {"sh","-c","at 2115 Dec 7 < /export/home/usr1/abc.sh"});
    InputStream stderr = proc.getErrorStream();
    InputStreamReader isr = new InputStreamReader(stderr);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    logger.info("<ERROR>");
    while ( (line = br.readLine()) != null)
    logger.info(line);
    logger.info("</ERROR>");
    int exitVal = proc.waitFor();
    logger.info("Process exitValue: " + exitVal);
    My doubts are:
    1. Who is the owner of the output of "at"command, which gets executed under Oracle 10g App Server container?
    2. If no one is the owner, then where will the output of "at" command will go?
    3. Is there any other way to execute "at" command of UNIX in java program? If so, then please help me.
    Thanks in advance.
    regards
    Nandha Kumar.M

    I would imagine the process call out will be under the guise of the process owner of the OC4J instance which executing the call.
    Have you seen anything different.
    cheers
    -steve-

  • JSP executing FTP command

    Hi All,
    I'm a new developer in JSP. I'm just curious about Connecting to FTP Server by JSP. Can JSP use to execute ftp command or execute to FTP server? I want to display the list of files in directory on the ftp server. So, Please suggest your initiative or show the simple code for implement it.
    Regards,
    catjom

    JavaWorld published an article about this topic. It is called "Java FTP client libraries reviewed" and it can be found here :
    http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
    Best regards
    Jean-Pierre Norguet
    Jean-Pierre Norguet
    JavaWorld Press
    http://wasa.ulb.ac.be/jp.html

  • JSP executing UNIX command

    Hi,
    I'm new to JSP. I'm just curious whether is there a utility in Java that we can use to execute unix command?
    thanks.

    Hi,
    You can try this,
    import java.io.*;
    public class test
    public static void main(String args[]) {
    try {
    Process ps = Runtime.getRuntime().exec("ls -al");
    BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(ps.getOutputStream()));
    bw.write("1");
    bw.flush();
    String line;
    while ((line = br.readLine()) != null) {
    System.out.println(line);
    br.close();
    bw.close();
    System.out.println(ps.exitValue());
    catch(Exception e) {
    System.out.println(e);
    Hope that helps.
    Regards,
    Senthil Babu
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

  • Error while executing jdbc commands but getting connection pool

    I was not able to make a simple oracle connection and that hurts me.
    The program(jsp) is...
    <%@ page language="java" import="java.sql.*,java.io.*,
    java.util.*,pac1.*,javax.naming.*,javax.sql.*"%>
    <html>
    <body>
    <%
    Context ctx= new InitialContext();
    DataSource dsindogulf1=(DataSource)ctx.lookup("jnindogulf1");
    Connection conn=dsindogulf1.getConnection();
    if(conn!=null)
    System.out.println(conn.toString());
    else
    System.out.println("sorry");
    Statement st=conn.createStatement();
    String string1="CREATE TABLE Authorr(col1 CHAR(10));";
    st.executeUpdate(string1);
    %>
    </body>
    </html>
    If i delete the
    st.executeUpdate(string1); then there is no problem I get the connection pool. That means i am getting the connection. But when i include the
    st.executeUpdate(string1); there is an error which i cannot understand.. the error is
    Error 500--Internal Server Error
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-00911: invalid character
         at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
         at weblogic.jdbc.oracle.OracleImplStatement.execute()V(Optimized Method)
         at weblogic.jdbc.base.BaseStatement.commonExecute()V(Optimized Method)
         at weblogic.jdbc.base.BaseStatement.executeUpdateInternal()I(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.executeUpdate(Ljava.lang.String;)I(Unknown Source)
         at weblogic.jdbc.wrapper.Statement.executeUpdate(Ljava.lang.String;)I(Statement.java:360)
         at jsp_servlet.__test._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__test.java:149)
         at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
         at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3661)
         at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2630)
         at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
         at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
    the steps which i have followed are... I have made a connection pool using weblogic type 4 driver in the administrative console... then i have created the data source using jndi name jnindogulf1..... but although i am getting the connection pool i am receiving error ehice executing jdbc commands
    please help
    thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    babuli nayak wrote:
    I was not able to make a simple oracle connection and that hurts me.
    The program(jsp) is...
    <%@ page language="java" import="java.sql.*,java.io.*,
    java.util.*,pac1.*,javax.naming.*,javax.sql.*"%>
    <html>
    <body>
    <%
    Context ctx= new InitialContext();
    DataSource dsindogulf1=(DataSource)ctx.lookup("jnindogulf1");
    Connection conn=dsindogulf1.getConnection();
    if(conn!=null)
    System.out.println(conn.toString());
    else
    System.out.println("sorry");
    Statement st=conn.createStatement();
    String string1="CREATE TABLE Authorr(col1 CHAR(10));";
    st.executeUpdate(string1);
    %>
    </body>
    </html>
    If i delete the
    st.executeUpdate(string1); then there is no problem I get the connection pool. That means i am getting the connection. But when i include the
    st.executeUpdate(string1); there is an error which i cannot understand.. the error is
    Error 500--Internal Server Error
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-00911: invalid character
         at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
         at weblogic.jdbc.oracle.OracleImplStatement.execute()V(Optimized Method)
         at weblogic.jdbc.base.BaseStatement.commonExecute()V(Optimized Method)
         at weblogic.jdbc.base.BaseStatement.executeUpdateInternal()I(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.executeUpdate(Ljava.lang.String;)I(Unknown Source)
         at weblogic.jdbc.wrapper.Statement.executeUpdate(Ljava.lang.String;)I(Statement.java:360)
         at jsp_servlet.__test._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__test.java:149)
         at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
         at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3661)
         at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2630)
         at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
         at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
    the steps which i have followed are... I have made a connection pool using weblogic type 4 driver in the administrative console... then i have created the data source using jndi name jnindogulf1..... but although i am getting the connection pool i am receiving error ehice executing jdbc commands
    please help
    thanks
    Hi. Remove the semicolon from your SQL string:     stmt.executeUpdate("CREATE TABLE Authorr(col1 CHAR(10))");Joe                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need help with Telnet command in JSP

    Here is the code I have been working on but it will not display the buffer to the page..
    String [] cmd1 = {"cmd.exe","/c","telnet hqsun1.xx.xxxxx.com"};
              Process n;
              String T = "" ;
              n = Runtime.getRuntime().exec(cmd1);
              BufferedReader in1 =
              new BufferedReader(new InputStreamReader(
              n.getInputStream()));
              while((T=in1.readLine()) != null)
              out.println(T+"");
    Maybe someone has done this before? I am trying to acomplish a telnet net session to the screen with some exicuted commands, because this tool is going to be used to help determine system status when the help desk needs to check on something.
    Thanks

    I don't want to be discouraging, but I'm not quite sure you've thought the problem through. You say that you'd like to create a web page capable of providing various pieces of information to the help desk, and you suggest ping and the output of various canned telnet commands as examples.
    What is preventing the help desk from just executing those commands at the command prompt?
    I realize that the people working the help desk are (ahem) there for a reason, but it is really much faster for me to just simply type "ping www.mpalfrey.com" at the prompt, then it is for me to fire up the web browser and wait for a response that way. You will likewise find that it is a lot more convenient to perform diagnosis on remote machines directly from the command prompt.
    Uh, it's kind of like giving someone a screwdriver, then saying, "oh wait a second" and making them wear an oven mitt in order to use the screwdriver.
    But, if you really want to do it this way, the best thing to do is create a wrapper class that directly calls the system command and captures the output to a stringbuffer. Then your JSP page simply has to clone that wrapper via a new() command and trigger it if you go the singleton route. The code would look something like this...
    <%@ import page="com.mpalfrey.shellcommands.ping" %>
    <%
       myPing foo = new myPing( request.getParameter( "victim" ) );
       foo.trigger();
    %>
    Ping results:
    <%=foo.results()%>JSP can do a lot of wonderful things, but that doesn't mean you have to do it that way. :)

  • Trouble trying to execute a binary from jsp

    Hello,
    I need to make an http request to a Solaris box that will execute a binary that exports data.
    I have been connecting to the Solaris machine using putty and executing a command like this:
    /usr/prms/prod/bin/exportEngine -f/usr/prms/run/work/exportEngine/input/Export_Params.xml -s09/07/2008 -e09/08/2008Now I need to let this be available to users that need to do this from a web page. I am able to do a simple move command but executing this binary doesn't work. I have been working on this for hours, I tried dropping this command to a perl script and it will execute the move command but not the binary too. I'm afraid this is a permissions issue that jsp will not let a web page execute an arbitrary binary.
    The try/catch doesn't throw an exception, is there any other method that I can use to diagnose this? I'm new to jsp and Solaris, if anyone can help that would be great!
    Thanks,
    Jason
    Here is my code so far:
    <%
    String myErrors = "";
    try{
        // This command doesn't work
        //String[] command = {"sh","-c","/usr/prms/prod/bin/exportEngine -f/usr/prms/run/work/exportEngine/input/Export_Params.xml -s09/07/2008 -e09/08/2008"};
        // This test command works
        String[] command = {"sh","-c","mv /usr/prms/http/WebStationEE/supvops/test /usr/prms/http/WebStationEE/supvops/test_renamed"};
        final Process process = Runtime.getRuntime().exec(command);
    catch (Exception e){
        myErrors = myErrors + e.getMessage();
    %>
    <html>
      <body>
    <%
    out.println("myErrors: " + myErrors);
    %>
      </body>
    </html>

    evnafets wrote:
    What user is your server running as?
    Does that server have permissions to run whatever script you are wanting to run?
    I had a suspicion that it was a user issue. I'll look into it.
    evnafets wrote:
    Does this web request have to trigger the process or just pick up the results of running it?This is a process exports data from the Solaris box to a central database on a Windows box. It is automatically run daily but about one or two times a week a clerical staff person makes a mistake and the corrected data needs to be manually exported again. I have inherited this job and now I'm told that this needs to be put on a website (which is hosted on a Linux box lol) for the clerical staff to be able to plug in what day that needs to be rebuilt.
    Edited by: jholland18 on Sep 11, 2008 9:14 AM
    Edited by: jholland18 on Sep 11, 2008 9:24 AM

  • Executing two commands at the same time from Runtime.getRuntime

    Hi everybody,
    I m executing a command of imageMagic from javacode to crop and for changing the quality of image.The code is as below :
    String changeQuality = new String("convert " + originalImage
                        + " -crop " + imageWidth + "x" + imageHeight + "+" + imageX
                        + "+" + imageY + " -quality " + quality + " " + finalImage);
                   Runtime.getRuntime().exec(changeQuality);
    But before going to next page of jsp I want the size of the finalImage. So I m calling a new function from the base file, from which i m calling the above function, for getting the size of image:
    public String getSize(String finalImage) {
                   proc = Runtime.getRuntime().exec("identify " + finalImage);
    As identify cmd gives the size and various values of image but this command is showing the size zero. and if try to read the file then it shows FileNotFoundException.It means the file is not on the server.
    What should i do to execute both the command and getting the right result.
    Any help is appreciated.
    Thanks in advance.
    Vivek Kumar Gupta

    Hi everyone,
    Nobody ans my question but finally i got the ans of my question.
    I use a input stream for reading the first one imagemagic command. through this the second command execute after the first command finished its execution.
    And my images are now displaying without error.
    I know now you all are thinking how great mind I am!!! hai na
    Hmm woh to main hoon.
    post a question if u have over here. Perhaps i can solve your prob.

  • Executing shell commands from Java.

    I want to execute shell commands in Java using the Runtime.exec( String ) method.
    The method works fine under Linux OS, but under Windows '98 the method didn't work at all!
    For example the following call: Runtime.exec( "dir" ) throws an exception showing that the command was not completed. If I replace dir with ls under Linux all is good. What is the problem with the Microsoft Windows '98 ? Is there any solution at my problem ?!
    thx in advance!

    hey JSarmis,
    You can help me... "ls" doesn't work for me on linux.. using Runtime.exec, some commands work, others don't... you may hold the key to what i need? How did u get "ls" to work?

  • Shell commands from JSP after Forms migration

    During application migration from forms 9i to JSP & BC4J, I have to code the following Forms code into my JSP application.This is for a button pressed trigger.
    DECLARE
    RENAME_STRING VARCHAR2(120):= 'RENAME C:\BRC\PDATA' ||:DRAWING_ACCOUNTS.ACCOUNT_ID|| '.TXT P' || :DRAWING_ACCOUNTS.ACCOUNT_ID || TO_CHAR(SYSDATE,'DDMMYY')|| '.txt';
    BEGIN
    HOST( RENAME_STRING, no_screen );
    web.show_document( 'http://hostname/selectfile.html', '_new');
         IF NOT Form_Success THEN
              Message('Error -- File not Renamed.');
         END IF;
    END;
    How can I do this simple sending of OS commands in JSP, any ideas?

    Hi,
    Not only rename commands but I have to pass several other os commands like 'sqlldr' for data upload as well. Therefore, I need a reusable piece of code for that. I have acheived some way for that using the following code.
    put the following file in that package.
    package BankrecBC4J;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import java.text.*;
    import java.util.zip.*;
    class StreamGobbler extends Thread
    InputStream is;
    String type;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.type = type;
    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);
    } catch (IOException ioe)
    ioe.printStackTrace();
    public class GoodWindowsExec
    private static final boolean NATIVE_COMMANDS = true;
    //Allow browsing and file manipulation only in certain directories
         private static final boolean RESTRICT_BROWSING = false;
    //If true, the user is allowed to browse only in RESTRICT_PATH,
    //if false, the user is allowed to browse all directories besides RESTRICT_PATH
    private static final boolean RESTRICT_WHITELIST = false;
    //Paths, sperated by semicolon
    //private static final String RESTRICT_PATH = "C:\\CODE;E:\\"; //Win32: Case important!!
         private static final String RESTRICT_PATH = "/etc;/var";
         * Command of the shell interpreter and the parameter to run a programm
         private static final String[] COMMAND_INTERPRETER = {"cmd", "/C"}; // Dos,Windows
         //private static final String[] COMMAND_INTERPRETER = {"/bin/sh","-c"};      // Unix
         * Max time in ms a process is allowed to run, before it will be terminated
    private static final long MAX_PROCESS_RUNNING_TIME = 30 * 1000; //30 seconds
         //Normally you should not change anything after this line
         //Change this to locate the tempfile directory for upload (not longer needed)
         private static String tempdir = ".";
         private static String VERSION_NR = "1.1a";
         private static DateFormat dateFormat = DateFormat.getDateTimeInstance();
    public GoodWindowsExec(String g)
    System.out.println(" hello " + g);
    /*if (g.length < 1)
    System.out.println("USAGE: java GoodWindowsExec <cmd>");
    System.exit(1);
    try
    String osName = System.getProperty("os.name" );
    String[] cmd = new String[3];
    System.out.println("here ");
    if( osName.equals( "Windows NT" ) )
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[2] = g;
    else if( osName.equals( "Windows 2000" ) )
    System.out.println("Windows 2000");
    cmd[0] = "command.com" ;
    cmd[1] = "/C" ;
    cmd[2] = g;
    else if( osName.equals( "Windows XP" ) )
    System.out.println("Windows XP");
    cmd[0] = "command.com" ;
    cmd[1] = "/C" ;
    cmd[2] = g;
    else if( osName.equals( "Windows 95" ) )
    cmd[0] = "command.com" ;
    cmd[1] = "/C" ;
    cmd[2] = g;
    Runtime rt = Runtime.getRuntime();
    System.out.println("Execing " + cmd[0] + " " + cmd[1]
    + " " + cmd[2]);
    Process proc = rt.exec(cmd);
         * Starts a native process on the server
         *      @param command the command to start the process
         *     @param dir the dir in which the process starts
    // any error message?
    StreamGobbler errorGobbler = new
    StreamGobbler(proc.getErrorStream(), "ERROR");
    // any output?
    StreamGobbler outputGobbler = new
    StreamGobbler(proc.getInputStream(), "OUTPUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    } catch (Throwable t)
    t.printStackTrace();
         * Converts some important chars (int) to the corresponding html string
         static String conv2Html(int i) {
              if (i == '&') return "&amp;";
              else if (i == '<') return "&lt;";
              else if (i == '>') return "&gt;";
              else if (i == '"') return "&quot;";
              else return "" + (char) i;
    static String startProcess(String command, String dir) throws IOException {
              StringBuffer ret = new StringBuffer();
              String[] comm = new String[3];
              comm[0] = COMMAND_INTERPRETER[0];
              comm[1] = COMMAND_INTERPRETER[1];
              comm[2] = command;
              long start = System.currentTimeMillis();
              try {
                   //Start process
                   Process ls_proc = Runtime.getRuntime().exec(comm, null, new File(dir));
                   //Get input and error streams
                   BufferedInputStream ls_in = new BufferedInputStream(ls_proc.getInputStream());
                   BufferedInputStream ls_err = new BufferedInputStream(ls_proc.getErrorStream());
                   boolean end = false;
                   while (!end) {
                        int c = 0;
                        while ((ls_err.available() > 0) && (++c <= 1000)) {
                             ret.append(conv2Html(ls_err.read()));
                        c = 0;
                        while ((ls_in.available() > 0) && (++c <= 1000)) {
                             ret.append(conv2Html(ls_in.read()));
                        try {
                             ls_proc.exitValue();
                             //if the process has not finished, an exception is thrown
                             //else
                             while (ls_err.available() > 0)
                                  ret.append(conv2Html(ls_err.read()));
                             while (ls_in.available() > 0)
                                  ret.append(conv2Html(ls_in.read()));
                             end = true;
                        catch (IllegalThreadStateException ex) {
                             //Process is running
                        //The process is not allowed to run longer than given time.
                        if (System.currentTimeMillis() - start > MAX_PROCESS_RUNNING_TIME) {
                             ls_proc.destroy();
                             end = true;
                             ret.append("!!!! Process has timed out, destroyed !!!!!");
                        try {
                             Thread.sleep(50);
                        catch (InterruptedException ie) {}
              catch (IOException e) {
                   ret.append("Error: " + e);
              return ret.toString();
    In the first line of the JSP file include the package
    <%@page import="BankrecBC4J.*" %>
    and call
    it this way:from the jsp page
    new GoodWindowsExec ("calc"); //
    which should open up the calciulator, and should do for other os commands as well.
    Thanks

  • How to Execute shell commands in OSB

    Team,
    My Requirement:
    I have two sftp servers name ServerA and ServerB. Need to copy files from ServerA and place it on ServerB and change the file permissions to 777 after placing the files.
    The user i am connecting to ServerB has the access to override file permissions.
    Steps
    1. With help of FTP adapter in OSB I am reading files from ServerA and writing on to ServerB  -- Completed and is working.
    2. How to override file permissions after placing the file ????? -- Yet to implement.
    Please suggest me how can i accomodate 2nd step.
    Thanks,
    Suman V.

    If by "execute shell commands" you mean actually
    running a shell process (as opposed to just forking
    and executing specified programs) then I'd advise
    against it. The last thing you want is for the
    clients to be running arbitrary commands on the
    server. You don't want to make it possible for the
    client to run "rm -fr /" on your server.Right.
    I was assuming (perhaps with more optimism than is really warranted) that the OP was going to be in complete control of which commands were executed--that there'd be a small, fixed set in response to certain user actions.

Maybe you are looking for

  • VPN IPSEC - Contabilizar a utilização

    Vocês saberiam me responder como faço para contabilizar o período de utilização de uma VPN IPSEC entre dois roteadores Cisco? Antecipadamente grata, Aline

  • Wildcards in classpath

    Hi, I am trying to deploy an application with a 3rd party API which has 10 .jar files. Is there a way I can use wildcards to specify these 10 .jar files? Basically I need to add all the .jar files from the main application folder to the classpath. I

  • REALLY Mysterious Gray Lines on Every Export (pictures)

    I'm working on a video that contains a white background, and the client's background is also pure white. Every export I give him has a gray vertical line showing on the left and right borders of the video. We've narrowed down every possible cause, an

  • Compare and adjust functionality for Solution Directory

    Hello all, I am trying to use the Compare and Adjust function with a Solution Directory. There is a previous discussion about how to do this between a Master Template and Implementation Project. Now that the Solution Directory exists, I would like to

  • Adding a container to sap.m.Page causes container height to be 0px. Any fixes?

    In a simple SAP UI5 mobile app if I add a TileContainer to a sap.m.Page, the TileContainer's height is set to zero. Try to save the attached txt file, by changing the extension to .html and then open in the browser. Go to page 2 and inspect the dom e