How to execute package from Servlet

Hi all...
I have set of class files in a package called iDen_parser.
My main class name is jump_calc..
String[] cmd={"cmd.exe" , "/c" ,"java iden_parser.jump_calc","d:/test.log","d:/test.txt"};
Runtime runtime = Runtime.getRuntime();
process = runtime.exec(cmd);
I am not getting any output...
I have placed the folder Iden_parser in current working directory itself.
While I when I am trying out simple program HelloWorldApp, it's working out fine.
String[] cmd={"cmd.exe" , "/c" ,"java HelloWorldApp};
Runtime runtime = Runtime.getRuntime();
process = runtime.exec(cmd);
So anyone ,pls help me out in executing the pakage from servlets
Thnk
VIjay

Hi...
I am placing my code here
String path1 ="cmd /c dir /d";
String[] cmd={"cmd.exe" , "/c" ,"java
java HelloWorldApp"};
String[] path ={"cmd.exe",null, "
java iden_parser.jump_calc", "d:/test.log","
d:/mygod.txt"};
Replace....
String[] path ={"java iden_parser.jump_calc", "d:/test.log","
d:/mygod.txt"};
Runtime runtime = Runtime.getRuntime();
Process process = null;
try {
process = runtime.exec(path);
Replace....
process = runtime.exec(path, null, "the dir from where u call the stand alone program on command prompt");
outHTML.println("PAth" +path);
BufferedReader in =
new BufferedReader(new
er(new InputStreamReader(process.getInputStream()));
// Read and print the output
String line = null;
outHTML.println("Something had happen");
if((line = in.readLine()) == null)
outHTML.println("Empty");
while ((line = in.readLine()) != null) {
outHTML.println(line);
catch (Exception e) {
outHTML.println("Did not execute the command
command " );
//out.println("Problem with finger: " +
// ServletUtils.getStackTraceAsString(e));

Similar Messages

  • How to install packages from local folder

    Hi all,
    I have downloaded all arch linux packages from the following URLs:
    ftp://mirrors.kernel.org/archlinux/core/os/i686/
    ftp://mirrors.kernel.org/archlinux/extra/os/i686/
    ftp://mirrors.kernel.org/archlinux/community/os/i686/
    and then have saved them to an external hard disk. Then I have attached that external hard disk to my system and packages are available in following folders:
    /mnt/external_hd/Arch_Linux/Core-OS/
    /mnt/external_hd/Arch_Linux/Extra-OS-1/
    /mnt/external_hd/Arch_Linux/Extra-OS-2/
    /mnt/external_hd/Arch_Linux/Community-OS-1/
    /mnt/external_hd/Arch_Linux/Community-OS-2/
    /mnt/external_hd/Arch_Linux/Community-OS-3/
    Now I want to install some or all packages from these folder with the help of pacman command. I am seeing that package corresponding to wvdial command is available in the /mnt/external_hd/Arch_Linux/Extra-OS-1/ folder. But how to use pacman command so that I can install wvdial package from that folder?
    In addition to this if I want to install ALL Extra Packages available in the folders /mnt/external_hd/Arch_Linux/Extra-OS-1/ and /mnt/external_hd/Arch_Linux/Extra-OS-2/ then how to execute the pacman command?
    Please send me step by step instructions so that I shall be able to install some or all downloaded packages.
    I shall remain thankful for this forever.
    Best Regards ...
    Pankaj Kumar

    Hi fukawi2,
    Thanks for reply and searching for my username on google. It is true that I am a freelance s/w developer but I am not installing Arch Linux for any client. I am installing it due to some other reasons. In fact I started working on Red Hat and then on Fedora when I was a student of bachelor degree course in computer applications. Then later I searched open suse and started using it. I am using open suse from its 10.1 version. However the recent version of this distribution has become much resource consuming. So I am in the need of a light weight linux distribution. And I encountered Arch Linux. Then I purchased its installation disk from an online shop and installed it on my system. But only text mode is working at this moment. Since I want to use X window and so I started to follow the syntax of pacman command. But it is connecting to internet. Since my internet connection is slow (average speed of 10kbps) and so I requested the same online shop to download all packages from Arch Linux repository and send them to me. Therefore now I am having all those packages in my local external hard disk drive in the folder mentioned in my first post. Now I want to install packages from these folder. And so in order to get help I have come to this forum.
    I have also followed the steps given on the pages https://wiki.archlinux.org/index.php/Pa … l_commands and https://wiki.archlinux.org/index.php/Pa … repository. But when I am trying to install a particular package using the following command:
    pacman -U wvdial
    then it is asking for a dependency. I know that  the dependent package in my local folder but why it is not being automatically taken by pacman command? Can you please explain it.
    That is why I am asking help only for customization and usages of pacman in order to install packages from local folder. But each member in this forum is only referring to long written manuals and not giving me exact solution which I think will involve four/five steps.
    Best Regards ...
    Pankaj Kumar

  • How to execute code from a text file?

    Hello all!
    How to execute some code lines from a text file? For example my file is:
    String varname = "somecontents";
    JFrame frame = new JFrame();
    frame.setVisible(true);How can I get contents of this file and parse them if I want get new JFrame and access to the variable varname?

    I mean the PHP would generate a readable Java source,
    for example some variables with some data, and I just
    dont know what to do with file if I want generate the
    xls file from my saved data, could You help? :)Some variables, some data, PHP, Java, XLS file??? Al rather vague.
    You need to explain in more detail what it is you're trying to do if you want an answer to your question!

  • How to execute sql from table

    For a migration I have created a sql script that puts the full statement to be executed in a specific table column
    I'm now looking for a way how to execute those statements.
    Table structure like: oldName, newName, sqlStatement, id, otherField, otherField2
    Instead of the full statement(sqlStatement) it would also be possible to use the oldName, newName and id field if that simplifies the problem.
    The reason for building the statement and running that one is a) to validate upfront b) a self join is applied to the query result table to prevent some items for update.
    The initial idea was to take the sql statements and execute them as a sql script but that process is pretty slow.

    user2833655 wrote:
    For a migration I have created a sql script that puts the full statement to be executed in a specific table column
    I'm now looking for a way how to execute those statements.That is wrong, tables are for data not executable code
    Re: ref cursor - result set not known
    http://en.wikipedia.org/wiki/Data_%28computing%29
    >
    Data is often distinguished from programs. A program is a sequence of instructions that detail a task for the computer to perform. In this sense, data is thus everything that is not program code.
    >
    user2833655 wrote:
    The initial idea was to take the sql statements and execute them as a sql script but that process is pretty slow.This alternative will just make it difficult, complicated and unreliable as well.

  • How to install packages from removable media?

    I'm pretty damn sure that i missed some wiki page, but i cannot find it, how do i install packages without an internet connection. I installed on one of my computers, then realized i needed to install the wireless drivers after the install, which i cannot. I can ofcourse reinstall, but i believe there must be a possibility to make pacman install a bunch of packages from USB or a cd. I do have internet at my other computer, so i can download the packages there onto a usb-stick.

    Hi,
    you should try
    pacman -U /path/to/package.pkg.tar.gz
    I haven't tried this but that's the way one would manually install a package build with PKGBUILD and "made" with makepkg.
    Hope that helps.

  • How to show colors from servlet

    Greetings
    Please give me a example of how to show color baground and how to show buttons and list objects from servlets.
    Thanks in advance

    Here is the code sample:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ServletSample extends HttpServlet {
      public void service(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
        PrintWriter pw = response.getWriter();
        pw.println("<html>");
        pw.println("<head>");
        pw.println("</head>");
        //set background color   
        pw.println("<body bgcolor="#99cccc">");
        //list object?
        ServletContext context = getServletContext();
        pw.println(context.getRealPath("/."));
        //create a submit button   
        pw.println("<button type=\"submit\">A Submit Button</button>");
        pw.println("</body>");
        pw.println("</html>");
    }I recommand to take a tutorial or a book on Servlet

  • How to send mail from servlets

    m having troubles sending mail from servlets...
    how do you use the SimpleMailUser object needed in the session?
    a sample code on this would be of great help, thanks!

    <html>
    <body bgcolor="white">
    <font size=5 color="black">
    <%@ page import="javax.servlet.http.HttpUtils" %>
    <%@ page import="java.util.*" %>
    <%@ page import = "java.sql.*" %>
    <%@ page import = "java.io.*" %>
    <%@ page import= "sun.net.smtp.SmtpClient" %>
    <%
         String from,to,subject,msgbody,serverName;
         try
    from = request.getParameterValues("from")[0];
    to = request.getParameterValues("to")[0];
    subject = request.getParameterValues("subject")[0];
    msgbody = request.getParameterValues("msgbody")[0];
    serverName = request.getParameterValues("server")[0];
         catch (Exception e)          // Generally Speaking, an Error getting one of these
                                       // Values means that it wasnt passed in; inform the user
              out.println("You must call this JSP from this ");
              out.println("<A href=\"FormMail.htm\"> form</A>.<BR>");
              out.flush();return;
    %>
    Hold On A Moment while I try to Send Your Mail... <BR>
    <%
         out.flush();
         // Here are the real guts of the mail sending
         try
         sun.net.smtp.SmtpClient sm = new sun.net.smtp.SmtpClient(serverName);
         sm.from(from);
         sm.to(to);
         PrintStream msg = sm.startMessage();
         msg.println("To: ");     // Note dont use + for Performance
         msg.println(to);
         msg.println("Subject: ");
         msg.println(subject);
         msg.println();
         msg.println(msgbody);
         msg.println("==============");
         msg.print("This mail brought to you by JSP MAIL..from a user at IP ");
         msg.println(request.getRemoteHost());
         sm.closeServer();
         out.println("Your Mail Has Been Sent!");
         catch (Exception e)
              out.println("The mail couldn't be sent, probably because the mailhost wasnt set correctly.<BR> ");
              out.println("The error message I am getting is: ");
              out.println(e.getMessage());
    %>
    <BR>
    <BR>
    Click here to send another!

  • How to call JSp from Servlet??

    Hello,
    I want to call JSP page from servlet.I am using Visual Age For java 3.4. What is wrong in my code??
    if (userExists) {
    f.setErrors("userName","Duplicate User: Try a different username");
    getServletConfig().getServletContext().
    getRequestDispatcher("/jsp/forms/retry.jsp").
    forward(request, response);
    I am not able to get the o/p. Pls help.

    I can't see anything obvious, but did you take any steps towards doing output before this code (like openning an output stream)?
    Not clear what f.setErrors does - presumably stuffs the error message in an attribute of the request.

  • How to execute program from any dir?

    For example javadoc.exe is in D:\jdk1.3\bin.
    And I need to execute it from current dir.

    If you are running a Javadoc from DOS or the WinNT command shell, the proper command is
    D:\JDK1.3\BIN\JAVADOC.EXE <params>
    If you want to avoid typing this each time, type the following at the command prompt:
    PATH=%PATH%;D:\JDK1.3\BIN
    The command JAVADOC.EXE will then function without specifying the directory. The proper action is normally to add the JDK to your PATH environment variable when installing it.
    In Windows 2000, you can modify your PATH variable by right-clicking My Computer and selecting the Advanced tab followed by the Environment Variables button. It is usually best to edit the PATH in the System Variables section to ensure that all users on your system receive the updated PATH variable.
    In Windows 95/98, I -think- that the appropriate action is to open your AUTOEXEC.BAT file and locate the last line that says PATH=<stuff>. Add the following to that:
    Old: PATH=C:\ADIR;C:\ANOTHER
    New: PATH=C:\ADIR;C:\ANOTHER;C:\JDK1.3\BIN
    I think this is appropriate for Win 95/98, but I'm not sure. Correct me if I'm wrong.
    Good luck!

  • How to create database from servlet?

    Hey all,
    I want to create database and store the tables in that database.
    I don't have idea.
    any help..
    the concern is...
    I am using WSAD as a IDE.my backend is Oracle.
    First ,I need to check if user having ms-access in his system.if yes
    then I need to create datbase in that ..and store some tables in that database .
    any sample code snippet helpful for me..

    ok.Thank you.
    I am developing business application.The users enter some data.and I am storing that data into the oracle database.
    for every month...they need to check again that data and validate.
    for that...I want to create MS-access connection and get (oracle ) those data and store in ms-access ,I need to give link for that data to validate them. after that I will update.
    I don't have any idea how to store the data after i am retrieving data from the oracle database.how to generate link to that.
    now...I am trying to create database connection to the MS-ACCESS.I am
    using WSAD 5.1.2 VERSION.and jdk 1.4 version.
    below is my code..for connecting ms-access..
                        System.out.println("start connect");
                        try {
                             Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
                        } catch (Exception e1) {
                             e1.printStackTrace();
                        System.out.println("connected..");
                   Connection con=DriverManager.getConnection("jdbc:odbc:msd","","");
                   Statement stmt=con.createStatement();
                   result=stmt.execute("create table test(col1 char(10))");
                   System.out.println("the success");
    its giving below error. I know that the classpath error.But where I need to give that classpath .I think I need to get driver software from somewhere.please any suggestions......
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at java.lang.Class.forName1(Native Method)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at java.lang.Class.forName(Class.java(Compiled Code))
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.philips.servlets.DBGenerationServlet.dbCreate(DBGenerationServlet.java:102)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.philips.servlets.DBGenerationServlet.doPost(DBGenerationServlet.java:87)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.philips.servlets.DBGenerationServlet.doGet(DBGenerationServlet.java:73)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    [4/7/06 19:32:53:699 SGT] 7f4721ba SystemErr R      at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    [4/7/06

  • How to execute and test servlets

    I wounder if smbd can explain me what software do I need to execute my servlet program. I'd like to test my first servlet on local machine. How to do that?
    thnks

    Erm to be more helpful...
    Tomcat is a servlet container freely downloadable from Apache. You will find it here:
    http://jakarta.apache.org/tomcat/index.html
    with documentation on how to use it.

  • How to execute commands from Java

    hi,
    i m trying to execute a CVS command from a java environment. i m writing this code to create a user. for this i m executing this cvs command "cmd /c cvs passwd -r <username> -a <new-username>"
    after executing this cmd the command prompt will prompt for a pasword and then after entring the password i have to retype the password for confirmation. the existing code execcutes the command but i don t know how to read the prompt for password.
    <code>
    import java.io.*;
    import java.lang.*;
    public class first {
    public static void main(String[] args) {
    try {
    Process p = Runtime.getRuntime().exec("cmd /c cvs passwd -r gopalakrishnan_k -a ram");
    InputStreamReader reader=new InputStreamReader(System.in);
    BufferedReader OptFromCmd = new BufferedReader(new InputStreamReader(
    p.getInputStream()));
    BufferedReader fromKeyboard = new BufferedReader(reader);
    BufferedReader stdError = new BufferedReader(new InputStreamReader(
    p.getErrorStream()));
    OutputStream stdOut = p.getOutputStream();
    String s;
    String pswd = "mahesh";
    System.out.println("Success");
    int i = 0;
    while ((s = OptFromCmd.readLine()) != null) {
    //s = OptFromCmd.readLine();
    i++;
    System.out.println(s);
    System.out.println(i);
    if (i > 1) {
    stdOut.write(pswd.getBytes());
    stdOut.flush();
    System.out.println(
    "Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null) {
    System.out.println(s);
         /* Your Password Here */
         String password="Password Please";
         stdOut.write(password.getBytes());
    stdOut.flush();
         stdOut.write(password.getBytes());
    stdOut.flush();
         /* Your Password here */
    OptFromCmd.close();
    stdError.close();
    stdOut.close();
    } catch (Exception e) {
    e.printStackTrace();
    </code>
    [o/p]
    this program gives the output as
    adding the user <username>
    password:
    now i need to enter the password from java envronment and provide it in the command prompt .
    then it prompts for the password again for confirmation so i have to retype the password again
    how to acheive this.

    String abc[]={"sh","-c","/dir1/dir2/dir3/scanVirus/uvscan --clean -- delete --exit-on-error ../*.*>abcde.txt"};
    Runtime runtime = Runtime.getRuntime();
    Process p = runtime.exec(abc);
    when it founds any infected file the process is not terminated correctly and it gives the following error :
    "java.lang.Exception: Process failed to terminate correctly"
    but it deletes the infected file.
    and running the program second time (after deletion of infected file), it executed fine.
    Wating for help.
    Regards,
    Sundeep.

  • How to execute FM from Javascript function?

    Hi All,
    I have a requirement to execute ABAP FM from Javascript function in BSP Application.
    How do I implement this?
    Is there any document/link in SDN?
    Thanks
    Thruna Shanmuga

    Hi,
    When button is clicked capture the event in OnInPutProcessing and call the function module.
    In layout mention the java code
    Here is a sample code:
    Layout Code:
    < script >
    document.on keydown=function( )
    if (event.key Code==13)
    htmlb SL(this,2,'get') Mention the button ID
    < /script >
      <htmlb:button id      = "get"
                             text    = "Execute"
                            width   = "35%"
                            on Click = "On InputProcessing()" />
    OnInPutProcessing Code:
    data:
      w_event type ref to cl_htmlb_event,
    call method cl_htmlb_manager=>get_event
      exporting
        request = runtime->server->request
      receiving
        event   = w_event.
    case w_event->id.(To capture the event)
    when 'get'.
    <<Call the function module>>
    endcase.
    Hope this solves the issue, Let me know if any queries.
    Regards,
    Rajani

  • How to return arraylist  from servlet to midlet

    hi everybody !
    Can anybody help me in solving this problem.
    I am working on an application in which I am using Midlet to servlet
    communication.
    In this I am sending username and password from Midlet to servlet .
    At server side servlet check the authentication and send the corresponding
    contactlist of user from database to the MIDLet.
    On Midlet this list should appear list-wise.
    please tell me that how can I achieve this....
    Thanks in Advanced....
    bhagwat

    Hi,
    Can u say how to lock folder without using any tools??
    If i click on folder,it should ask for password.if the entered value is valid,the folder should open....
    Can u provide code for this????
    Is there any need to interact with operating system???
    Please reply me soon..
    Thanks in advance...
    Vinoda

  • How to pass Bean from servlet to jsp

    I had fetched record from my database to my servlet and passed it to bean.
    how should i pass that bean to my jsp to display the record values in their corresponding textboxes??

    leozeo write: I had fetched record from my database to my servlet and passed it to bean.
    how should i pass that bean to my jsp to display the record values in their corresponding textboxes?? Post the code

Maybe you are looking for