Process proc=runtime.exec("sh","-c","//home//usr//mkdir abcd") not working

my servlet calling the above line is not executing to make a directory
"abcd" at specified location. i am using Mandrake Linux and Tomcat... can anybody expalin the error.

Hi raghutv,
I also have this error
I use Tomcat 4.0 and Window Me
Do u think that the problem is "Window OS" or Tomcat Setting
I have a problem. I want to complie the other Java Program "hi.java" using servlet.
I am compiling the servlet code succesfully, but the web page can't display anything.
The real path of "hi.java" is in the
D:\Program Files\Apache Tomcat 4.0\FYP\WEB-INF\classes\hi.java
This is my servlet code..............pls help.............thx!
/*********************** Hello.java *********************/
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Hello extends HttpServlet
public void service(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
try {
String path = getServletContext().getRealPath("\\WEB-INF\\classes\\hi.java");
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec("javac.exe " + path);
BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
PrintWriter com_out = res.getWriter();
com_out.println("<pre>");
String line = null;
while((line = br.readLine()) != null){
com_out.println(line);
//String[] cmd = { "ping.exe", "time.nist.gov" }; // Command and argument
//String[] cmd = { "javac.exe","hi.java"}; // Command and argument
//Process process = Runtime.getRuntime().exec(cmd); // Execute command
//Process process = Runtime.exec(cmd); // Execute command
//process.waitFor(); // Wait until process has terminated
catch (Exception e) {
System.err.println(e);

Similar Messages

  • Spawn a java process using runtime.exec() method

    Hi,
    This is my first post in this forum. I have a small problem. I am trying to spawn a java process using Runtime.getRuntime().exec() method in Solaris. However, there is no result in this check the follwoing program.
    /* Program Starts here */
    import java.io.*;
    public class Test {
    public static void main(String args[]) {
    String cmd[] = {"java", "-version"};
    Runtime runtime = Runtime.getRuntime();
    try{
    Process proc = runtime.exec(cmd);
    }catch(Exception ioException){
    ioException.printStackTrace();
    /* Program ends here */
    There is neither any exception nor any result.
    The result I am expecting is it should print the following:
    java version "1.4.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
    Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
    Please help me out in this regard
    Thanks in advance
    Chotu.

    Yes your right. It is proc.getInputStream() or proc.getErrorStream(). That is what I get for trying to use my memory instead of looking it up. Though hopefully the OP would have seen the return type of the other methods and figured it out.

  • Interact with extern process by Runtime.exec()

    Hi,
    I want interact with a extern process by Runtime.exec(), but I don't Know the way for introduce the params required for the extern process.
    So, Is posible, interact with the extern process from Java?
    Thanks

    Exactly, I would like to know how exec can pass a PIN
    number when the proccess already has been launched. Sounds like you're doing it through the process' stdin. Read that article I linked.
    You'll have to call Process.getOutputStream() or whatever that method is. To you it's an OutputStream, to the process, it's input. You'll write the stuff to that stream that you'd type to the command line. If you want to get that from the user interactively, you'll do it like you would any interactive user input in any Java program--get it by reading System.in or from some GUI element, and then take that and write it to the process' stream.
    If you're not familiar with I/O in Java, look here:
    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • HT4623 iOS 6.1 no longer available because you are no longer connected to the internet- this is what my iphone 4 shows. iv tried switching off again and again, closing apps by double tapping the home button but still not working. please help.

    this is what my iphone 4 shows. iv tried switching off again and again, closing apps by double tapping the home button but still not working. please help.
    is there any other method to download ios 6.1.2.
    my phone is not being recognized by itunes on my new windows 8. neither its working on touch copy.
    kindly help.
    thanks

    well in thatcase, i need another help .
    thanks for your instant reply.
    i have currently bought a new laptop (windows 8) and my iphone is not being recognized by itunes.
    because i have no backup on my previous laptop, i downloaded touchcopy but even touch copy is not recognizing my iphone.

  • Start a new java process using Runtime.Exec() seems to ignore the -Xmx

    I am working with a process that requires a minimum of 1.5 GB to run and works better if more is available.
    So I am determining how much memory is available at startup and restarting the jre by calling
    Runtime.exec("java -Dcom.sun.management.jmxremote=true -Xmx1500M -jar XXX.jar")
    which reinvokes the same process with a new max memory size.
    The initial call to the process is
    java -Dcom.sun.management.jmxremote=true -Xmx3500M -jar XXX.jar
    The initial call returns 3262251008 from Runtime.maxmemory()
    When reinvoked through Runtime.exec() as above
    Runtime.maxmemory() still returns 3262251008
    Is there a way to separate the new process from the size specified by the parent process?

    That is strange. Here is a program I wrote which calls itself recursively.
    import java.io.IOException;
    import java.io.InputStream;
    import java.util.List;
    import java.util.ArrayList;
    import static java.util.Arrays.asList;
    public class MemorySize {
        public static void main(String... args) throws IOException, InterruptedException {
            System.out.println("Maximum memory size= "+Runtime.getRuntime().maxMemory());
            if (args.length == 0) return;
            List<String> cmd = new ArrayList<String>();
            cmd.add("java");
            cmd.add("-cp");
            cmd.add(System.getProperty("java.class.path"));
            cmd.add("-Xmx"+args[0]+'m');
            cmd.add("MemorySize");
            cmd.addAll(asList(args).subList(1,args.length));
            Process p = new ProcessBuilder(cmd).start();
            readin(p.getErrorStream());
            readin(p.getInputStream());
        private static void readin(final InputStream in) {
            new Thread(new Runnable() {
                public void run() {
                    try {
                        byte[] bytes = new byte[1024];
                        int len;
                        while((len = in.read(bytes))>0)
                            System.out.write(bytes, 0, len);
                        in.close();
                    } catch (IOException e) {
                        e.printStackTrace();
            }).start();
    }If you run this with the args 128 96 33 222 it prints out
    Maximum memory size= 66650112
    Maximum memory size= 133234688
    Maximum memory size= 99942400
    Maximum memory size= 35389440
    Maximum memory size= 231014400

  • Socket stays open after java process exits, Runtime.exec()

    I have a program that does the following:
    opens a socket
    Does a runtime.exec() of another program
    then the main program exits.
    what i am seeing is, as long as the exec'd program is running, the socket remains open.
    What can i do to get the socket to close?
    I even tried to explicity call close() on it, and that didn't work. Any ideas would be great.
    I am running this on WindowsXP using netstat to monitor the port utilization.
    here is some sample code
    import java.io.*;
    import java.net.*;
    public class ForkTest
        public static void main(String[] args)
            try
                DatagramSocket s = new DatagramSocket(2006);
                Process p = Runtime.getRuntime().exec("notepad.exe");
                System.out.println("Press any key to exit");
                System.in.read();
            catch (IOException ex)
                ex.printStackTrace();
    }

    java.net.BindException: Address already in use: Cannot bind
            at java.net.PlainDatagramSocketImpl.bind(Native Method)
            at java.net.DatagramSocket.bind(DatagramSocket.java:368)
            at java.net.DatagramSocket.<init>(DatagramSocket.java:210)
            at java.net.DatagramSocket.<init>(DatagramSocket.java:261)
            at java.net.DatagramSocket.<init>(DatagramSocket.java:234)
            at ForkTest.main(ForkTest.java:11)

  • Home/sleep button is not working properly. why?

    i just bought i new ipod on ebay. But home and sleep button on my ipod touch 4th generation is not working properly after long sleep time. but it works properly when its plugged-in for charging..why? how can i solve it?

    Hi,
    Try resetting your iPod:  http://support.apple.com/kb/HT1430. 
    Hope this helps! 
    ---likeabird---

  • Process chain - After error ABAP - trigger a metachain start does not work.

    Hi,
    I have a process chain, where after an ABAP runs into red (ERROR MESSAGE triggered), another process type, like start a new meta-chain, or start an infopackage starts.... But is does not work. After i go to logs, it asks me whether i want to trigger the following jobs, if i choose yes, it works. But i need to start it automatically, when the ABAP Routine has an error message (RED) in the chain.
    Any idea, because I tried to solve it all the day, but i did not manage to get itwork...
    Many Thanks,
    L.

    Hi,
    the problem is not the ABAP Program.
    I have the following situation:
    A Metachain contains as second step a call of local chain. After the local chain, according to the status of it (green o red), we have other different steps. So we have two different link (red and green) starting from the local process chain step.
    Inside the local process chain there is the ABAP program that check several parameters and if something is not as expected fails with status red. if this situation happens, the local process chain becomes red and in SM37 inside the job i see the error that i forced, but the status is not triggered to the first metachain , so the corresponding following steps are not triggered.
    This issue happens only if fails the ABAP program because, for example, a Infopackages loading fails every thing works and the corresponding steps in the metachain are executed.
    In the ABAP program in order to force the status red we have the following code:
    MESSAGE e162(00) WITH 'Status' 'Red'.
    Any idea?
    Thanks,
    Veronica

  • BPEL Process with multiple file types using one FTP adapter is not working

    i created a bpel process which will fetch the files from remote location using FTP adapter.
    Now the process works for only one format or file type like *.xls.
    How can i use more than one file format in one FTP adapter.
    OR
    is there any other way to do it.
    file type assignation is 5th step in FTP adapter configuration.
    i have tried *.xls,*.csv and *.xls;*.csv and *.xls:*.csv by seperating with comman, colon, space... still not working.
    i read the documentation *.* will not work.. for one file format it's working fine.
    looking forward for reply as soon as possible.

    Are you positive that it is not working? I'm not sure how you can use one FTP adapter for multiple file types unless the underlying data is exactly the same format or you are processing it as opaque data. Sometimes when a FTP adapter chokes on a file with a bad structure it doesn't create a BPEL instance, it simply moves the bad file to a separate folder.
    So I assume you are using opaque as the data type instead of using an XSD element?
    That said, I don't think you can put two separate file types in the filter. Is it possible for you to do something like: CommonFileName*.* or do you have similar files with other extensions?
    I know the above probably isn't of much help, but I had so many problems with the FTP adapter and its lack of features that I am writing my own. Unfortunately that is a large undertaking and there isn't any good documentation of JCA resource adapter / BPEL PM integration.

  • Home Share ATV 3 not working

    I cannot get Home Sharing to work on my ATV.  It works from my husband's iTunes account, but not mine, so I know we installed it correctly.  I logged out of iTunes on my computer and back in, and turned off Home Share on my computer and back on...nothing works. Any ideas?  Thanks in advance.

    Now iphone 5 not working?

  • Home Keys on Laptop not working sometimes

    Good Day,
    Our HP Pavilion G4-2013TX's keyboard acts up sometimes. The Home keys (i.e., A S D F J K L and semi colon) keys sometimes do not work. I just have to wait a bit or furiously press them to get them to work again.
    The keys are working currently (this message is evidence.) I don't know how to invoke the error at the moment.
    Please help. I've been getting instances that I need to have a good working keyboard but the homekeys don't cooperate. A Sort of troll, actually.
    Thanks in advance,
    Matt

    Hi @MattFromPH 
    Welcome to the HP Support Forums!
    I understand that you are having trouble with your keyboard behaving intermittently. I am happy to help with this.
    As a start I include the support page for your notebook, which includes the current HP modified drivers for your notebook, and also I link the service manual, which can be helpful when it comes to cleaning if followed carefully.
    HP Pavilion g4-2013tx Notebook PC
    HP Pavilion g4 Notebook PC - Maintenance and Service Guide
    With those two resources, then check out this page and see if anything helps with your problem.
    Notebook Keyboard Troubleshooting (Windows 7)
    Cleaning your Notebook PC
    Let me know if you need any more help.
    Malygris1
    I work on behalf of HP
    Please click Accept as Solution if you feel my post solved your issue, it will help others find the solution.
    Click Kudos Thumbs Up on the right to say “Thanks” for helping!

  • Home sharing for iTunes not working between my Windows 7 and Windows Vista?

    I have a HP laptop with Windows 7 on it. The laptop has the latest edition of iTunes. My desktop computer has Windows Vista and iTunes 9. When I turn on home sharing, the library on my Windows 7 appears under 'Shared' on my vista. However, the library from my vista will NOT appear on my laptop.
    I have turned the home sharing option on and off multiple times on both computers. I've also edited the preferences for the 'Sharing' option to make sure that both libraries can be seen and shared. Yet it still isn't working. I have even tried restarting my wireless router and it STILL is not working.
    Is anyone else having a similar problem or know how to help?

    In the course of your troubleshooting to date, have you also worked through the following document, Dea?
    iTunes for Windows Vista or Windows 7: Troubleshooting unexpected quits, freezes, or launch issues

  • Home and end key not working on ubuntu 14

    I am on Firefox on Ubuntu 14.
    Home and END keys do not work properly as they do not take me to the top or the bottom of a page. Caret browsing (F7) is not activated. This problem persists with all add-ons disabled.

    Shortcuts just for reference:
    [https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-tasks-quickly#firefox:linux:fx35]
    I understand that there are two short cuts that do not work with caret browsing turned off. Please also see this menu:
    Options > Advanced > disable "Always use the cursor keys to navigate within pages" option present in "General" tab.
    If this is not the issue, please also contact the party that compiles Firefox specifically for Ubuntu, unless you are using the linux from [https://support.mozilla.org/en-US/kb/install-firefox-linux here]?

  • HT201274 I went to General Reset Erase All Content & Settings - and now nothing works. I tried the advice on this forum, i.e., turn the phone off, connect to the white apple cable while pressing the home key. Still not working. What do I do?

    After i dod the above my ipone still does not work. It seems like all settings are gone. I tried the advice on one of the forums here which was turn the phone off, connect to the cable to the computer and not the phone, press the home button continously and connect the cable. Itunes at this point identified the phone and prompted to restore settings. It seemed to be doing something but now once I tried turning it on, its still not working.

    start iTunes,
    plug in your USB cable
    switch off your iPhone
    press holding home button(the round button in front of the Phone)
    plug it on to the USB cable
    keep holding the button
    till iTunes says it found a iPhone in recovery mode
    then click restore as a NEW iPhone
    then sync!?
    http://support.apple.com/kb/HT1414

  • IPhone home and lock buttons not working at all?

    I got my iPhone 4 in October 2010. Since then I have accidentally dropped it on the floor and the back cracked, and in April 2011 I accidentally dropped it in a tub of paint. A bit silly, I know, but I managed to get all of the paint off quite easily and it was fine. However, at the end of last year, the home button started to malfunction and get stuck and just generally not work. In the past few weeks I've noticed I get trouble with it at least once a day and have to sit and press it until it works. Then, today, just out of nowhere, the lock/power button at the top of my phone just stopped working, it's stuck. I don't really have a way to wake my phone now unless I press the home button until it works, and I can't lock it anymore. I don't know whether it would be anything to do with the paint, considering it happened a year ago.  Is there anything I can do to get it working again or do I need to take it to Apple?
    Thank you very much.

    Ok this Might work
    1- Try rubbing your home button with alchohol ( or perfume ) in a circular motion for about 20 seconds
    2 - do the same to ur power button ( from left to right and repeat ) for about the same duration
    3- press and hold both your power and home button at the same time ..
    ... If this doesnt work try it one more time
    If it doesnt respond after the second time i'm afraid u'll have to take it to an apple care center :(
    Wish u luck

Maybe you are looking for

  • Migrating Crystal Reports Server XI to a new Server

    Post Author: david_okeefe CA Forum: Deployment Hi,I am trying to migrate an existing Crystal Reports installation from an old server to a new server.  To prevent interruption of service, the new server must be able to be online at the same time as th

  • Why do we configure the Redundant Interface in CSS Public Face

    Hi, I have a question : Why do we configure the redundant interface in a CSS facing the public side of a CSS. I understand the need for the interface in the server side though. Please refer to the URL below; http://www.cisco.com/univercd/cc/td/doc/pr

  • Can I create a java app for my palm zire 71 that uses floating point calc

    I am an eclipse user that is looking at studio creator 2 and was wondering if I could create a java app for my palm zire 71. I have read alot about no floating point support in midp... is that true for java on the palm? If so, how does one calculate

  • Moving SATA RAID 0 array

    Any tips on how to move a SATA RAID 0 array between machines?  Is it possible?  Array was set up on an NF3 chipset.  Can it be moved to an NF4 or 5, or even an Intel or Promise?  If it includes the boot partition can you use Win XP Pro repair console

  • Warning - Contact picture may be open to strangers...

    This one's so serious I think it warrants a separate thread. A user in another recent thread reported that contact pictures are publicly visible in Skype search despite setting privacy to "Contacts Only". I doubted this, but got ahead and did my own