Embeded command line doesn't work

Can you tell me why this doesn't work
It won't work when there is a | or > involved in the syntax
Runtime rt;
Process prs;
prs = rt.exec("tifftopnm sample.tif | gocr -");
OR
prs = rt.exec("ls > outputFile");
And this example will worked fine.
prs = rt.exec("ls -alt");
Thanks,
Tom

I use an alternative form of exec()
import java.io.*;
public class ExecutingALinuxCommand
    static class PipeInputStreamToOutputStream implements Runnable
        PipeInputStreamToOutputStream(InputStream is, OutputStream os)
            is_ = is;
            os_ = os;
        public void run()
            try
                byte[] buffer = new byte[1024];
                for(int count = 0; (count = is_.read(buffer)) >= 0;)
                    os_.write(buffer, 0, count);
            catch (IOException e)
                e.printStackTrace();
        private final InputStream is_;
        private final OutputStream os_;
    public static void main(String[] args)
        try
            String[] command = {"sh","-c","ls > /home/sabre/out"};
            final Process process = Runtime.getRuntime().exec(command);
            new Thread(new PipeInputStreamToOutputStream(process.getInputStream(), System.out)).start();
            new Thread(new PipeInputStreamToOutputStream(process.getErrorStream(), System.err)).start();
            int returnCode = process.waitFor();
            System.out.println("Return code = " + returnCode);
        catch (Exception e)
            e.printStackTrace();
}

Similar Messages

  • I upgraded my iMac to 10.9.4.  Now the feature where you can go to 4 diff. screens (Command+Control) doesn't work.  How do I fix this?

    I upgraded my iMac to 10.9.4.  Now the feature where you can go to 4 diff. screens (Command+Control) doesn't work. 
    How do I fix this?

    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

  • My cellcom line doesn't work with my iPhone here in Israel, why? Is there any way I can solve this issue?

    My cellcom line doesn't work with my iPhone here in Israel, why? Is there any way I can solve this issue?

    Please explain.
    What does "cellcom line doesn't work with my iPhone" mean?
    What are you trying?  What is happening?
    Where did you buy the iphone?
    Any info abnout your issue at all?

  • HT1338 I'm trying to print a document fro safari and the print command is at the bottom of the page and not visible.  I can't move it up and the print command shortcut doesn't work.  How do I print this document.

    I'm trying to print a document from safari and the print command is at the bottom of the page and I can't move it up.  The print command shortcut doesn't work and I would like to know how I can print this document.

    Why do we have to install 2 add ins for something that should be built in? Please add this to the next version or an update to this one even. We should see the full path of a bookmark when we search for it. Show Parent Folder alone isn't enough if you have sub folders, so I installed Go Parent Folder as well in case of sub folders.

  • Right-Command Key doesn't work

    Well, on my PowerBook G4, there are 2 command-keys (I'm sure that's common).
    My right command key doesn't work what-so-ever. I tried using the keyboard viewer and it doesn't turn gray either. Funny thing, but when I press the LEFT one, both cmd keys turn gray.
    Well i dont know if its a missing driver or a setting, (maybe even a malfunctioning keyboard?) but if anyone can help I would appreciate it. Thanks.

    Sorry, my bad. Haven't read through it in awhile and thought it affected keyboard too, but looks like just trackpad and other issues described. You may just have a bad keyboard or something lodged under that key.

  • Command key doesn't work in several usual function.

    command key doesn't work in several usual function.
    Selected object does't change to transform mode by hold down command.
    and "command+2= lock the selected object " doesnt work as well..
    but, these shortcut is still ok. 
    command + c,v
    command + a
    command + select tool = whole select tool
    that is, the command key is not totally stopped.
    Im cs5 but I have had this trouble in cs4.

    causiu,
    It is possible that the issues may be caused by preference corruption or interference from other applications.
    You may try the following (you may have tried/done some of them already) and see whether it helps. Since you had it in CS4 too, the most likely is 5).
    1) Close down Illy and open again;
    2) Restart the computer;
    3) Close down Illy and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (irreversible);
    4) Move the folder with Illy closed (reversible);
    5) Look through and try out the relevant among the Other options, especially Item 7) with the usual suspects;
    Even more seriously, you may:
    6) Uninstall, run the Cleaner Tool, and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • Command + f2 doesn't work!

    Hi!
    Sorry for my english... but i try to explain my problem!
    I have an iMac27, two months ago i have bought a Dr. Bott for playing with my ps3. Ok, all works fine!
    Two weeks ago i came back from my holiday, i try to play but "command + f2" doesn't work!
    The problem is that it seems that command doesn't work because my mac doesn't try to seach any external signal... simply it do nothing! If i try "command + f1" or "command + f3", for example... they work!
    Can you help me!? My OS version is 10.6.4!
    Please, help me! Winter is coming and i have to play a lot!!!! :-D

    No, I'm suggesting that you test the ⌘F2 shortcut on something else, like Exposé (⇪). This is just to make sure that your keys aren't busted (or you could also just try using a different keyboard). If ⌘F2 works for Exposé, then go ahead and remove it from the Keyboard Settings to make sure your Dr Bott Video Link can use it again.
    As for checking why you're not able to receive a signal, are you sure you're using 720p from your PS3? Did you try using the HDMI cable on other devices (maybe connect your PS3 to an HDTV) to make sure it's not broken? This may sound obvious, but did you also check to make sure your Dr Bott is powered up (it might be dead; I dunno)?

  • Command Link doesn't work - may be a bug

    Hi all,
    I'm using JDev 11g. I added two pages to the adfc-config.xml file and a controlFlowCase from one to another. Page1--> Page2 The action name is "aaa".
    And then i added a command link to the Page1 and selected the action name "aaa". Now i'm click the command link, but it doesn't work. I'm shocked. What is the problem? It's so basic thing.
    Erdo

    I'm running just like you said. Here is the error log :
    oracle.jbo.JboException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-29000. Error message parameters are {0=java.lang.NullPointerException, 1=null}
         at oracle.adf.model.binding.DCIteratorBinding.reportException(DCIteratorBinding.java:376)
         at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1693)
         at oracle.adf.model.binding.DCIteratorBinding.internalGetRowSetIterator(DCIteratorBinding.java:1645)
         at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4395)
         at oracle.adf.model.binding.DCExecutableBinding.refreshIfNeeded(DCExecutableBinding.java:341)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.isAttributeUpdateable(JUCtrlValueBinding.java:1647)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.isAttributeUpdateable(JUCtrlValueBinding.java:1754)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.isUpdateable(JUCtrlValueBinding.java:2610)
         at oracle.adfinternal.view.faces.model.AdfELResolver._isReadOnly(AdfELResolver.java:96)
         at oracle.adfinternal.view.faces.model.AdfELResolver.isReadOnly(AdfELResolver.java:112)
         at javax.el.CompositeELResolver.isReadOnly(CompositeELResolver.java:353)
         at com.sun.faces.el.DemuxCompositeELResolver._isReadOnly(DemuxCompositeELResolver.java:290)
         at com.sun.faces.el.DemuxCompositeELResolver.isReadOnly(DemuxCompositeELResolver.java:319)
         at com.sun.el.parser.AstValue.isReadOnly(Unknown Source)
         at com.sun.el.ValueExpressionImpl.isReadOnly(Unknown Source)
         at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer._getUncachedReadOnly(EditableValueRenderer.java:486)
         at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.cacheReadOnly(EditableValueRenderer.java:416)
         at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.beforeEncode(LabeledInputRenderer.java:128)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:340)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:405)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer._encodeFormItem(PanelFormLayoutRenderer.java:1015)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer.access$100(PanelFormLayoutRenderer.java:46)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer$FormColumnEncoder.processComponent(PanelFormLayoutRenderer.java:1491)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer$FormColumnEncoder.processComponent(PanelFormLayoutRenderer.java:1410)
         at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:170)
         at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:290)
         at org.apache.myfaces.trinidad.component.UIXComponent.encodeFlattenedChildren(UIXComponent.java:255)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer._encodeChildren(PanelFormLayoutRenderer.java:352)
         at oracle.adfinternal.view.faces.renderkit.rich.PanelFormLayoutRenderer.encodeAll(PanelFormLayoutRenderer.java:187)
         at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1396)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
    ...

  • Command line won't work with ProcessBuilder

    Hi,
    I am trying to run the following command line from the ProcessBuilder:
    java -cp .\dist\ReflexionTest.jar ReflexionTest.Main2but I always get a
    CreateProcess error=2, the specified file cannot be foundYet, when I run the code from a DOS window, it works fine. I have made sure that both commands are started from the same directory.
    Anybody knows what is happening? How can I solve this?
    Thanks,
    J.

    I am using the second constructor.
    Here is the code for class Main1:
    package ReflexionTest;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStreamReader;
    public class Main1 {
        public static void main(String[] args) {
            System.out.println("Starting Main1");
            System.out.println("Main1 USER DIR = " + System.getProperty("user.dir"));
            ProcessBuilder MyPB = new ProcessBuilder("java -cp " + "ReflexionTest.jar" + " " + Main2.class.getName());
             File TempDir = new File(System.getProperty("user.dir") + File.separator);
             MyPB.directory(TempDir);
            Process TheProcess = null;
            try {
                System.out.println("Starting Main2 process\n");
                TheProcess = MyPB.start();
                System.out.println("\nExit value = " + TheProcess.exitValue() + "\n");
            } catch (IOException ex) {
                System.err.println(ex.toString());
    }And here it is for class Main2:
    package ReflexionTest;
    public class Main2 {
        public static void main(String[] args) {
            System.out.println("Main2 started !!!");
    }Both classes are in the same Netbeans project. Main1 tries to call Main2 from the ReflexionTest.jar itself. I have manually copied the ReflexionTest.jar file in the user dir file.
    Thanks,
    J.

  • Command line equivalent of Work Group Manager's export feature

    Hello everyone,
    I am have a hard time upgrading from Lion Server to Mountain Lion Server, especially with Open Directory. What I wish to do, is to import the existing users and groups of an existing server running Lion Server into a new (fresh) Open Directory master created on another server that is running Mountain Lion Server.
    I have tried several options. Those that did *not* work for me include:
    Trying to make create a replica of the Lion Open Directory on the Mountain Lion Server
    Trying to backup the OD of the Lion Server using slapconfig
    What seems to work (for the moment), is to use the export feature of Work Group manager on Lion and to import the users/groups using the import feature of Mountain Lion Server app.
    My question is: is there a command line way to do the export ? Since Work Group manager seems to be kind of deprecated in ML, I assume there must be some other way (i.e., from the command line) to do the user/group import and export.
    Thanks for your help !

    Notice that the old Archive and Restore options are gone. To run a backup, run the slapconfig command along with the -backupdb option followed by a path to a folder to back the data up to: 
    sudo slapconfig -backupdb /odbackups
    To restore a database (such as from a previous version of the operating system where such an important option was actually present) use the following command (which just swaps backupdb with -restoredb) 
    sudo slapconfig -restoredb /odbackups
    /usr/sbin/ServerBackup -cmd backup -source /

  • RH9 - Any idea why generating printable output from the Command Line doesn't include images?

    I have a batch file that creates a printable output of our main documentation broken up into 36 separate documents, 1 per chapter. Each chapter is a separate layout. I realize that RH has its own Batch building process, but the reason for me doing it through the command line via a batch file (.bat) is that RH keeps taking focus from my mouse and it makes it difficult to do any other computer work while the RH project generates the printable output for those chapters.
    Anyway, RH's Batch build works fine.
    But the command line for printable output does not include any of my images in the printable output. I don't know why. The document generates with all the topics fine, but the images are missing. No placeholder box in the resulting Word doc, they just simply weren't included. Has anyone else seen this? Any way to fix it?

    All,
    I thought it may be related to spaces in the path in which the script was called from. I tried having the ODBC command script in another directory but the same thing happens. It will give me the "CONFIGSYSDSN: Unable to create a data source for the 'Oracle in OraClient10g_home1' driver: Could not load the setup or translator library with error code -2147467259". As soon as the script is done running I can manually double click the script and it adds the DSN fine.
    Thanks,
    Clif Bridegum

  • Command-D doesn't work

    Recently Command-D has quit working across numerous applications. All other Command- shortcuts appear to be working. I'm using a Mac Pro Dual-Core 3 GHz with 10.5.1. Any ideas and solutions would be greatly appreciated.

    Sorry for the muddy question.
    I'm primarily using it in non-Apple applications, like InDesign (place file), Quicken (delete), and PowerCAD (delete).
    However, it doesn't work to Bookmark in Safari either.

  • Command-L doesn't work for full-screen PDF under Mac

    In Adobe Reader, users can use Ctrl-L to view PDF in full screen under Windows (Cmd-L under Mac);  in AIR, Ctrl-L still works under Windows but Cmd-L doesn't work under Mac. Is this a bug or the short-cut is intentionally disabled?

    Hi If using command r did not get you to the recovery partition, you ether don't have it or the drive is corrupt and it wont open.And you also tried option and only got the startup volume. You could try option r. Are you able to boot into your desktop? Or use another mac. You should be able to use you apple id to look in purchases and re-download Lion. Then if you can using at lest a 10 Gig thumb drive copy the lion download as bootable to it and use that to repair your disk. If you get it downloaded do not open it. until you copy it.http://www.macworld.com/article/1161069/make_a_bootable_lion_installer.html

  • Command q doesn't work

    command q no longer seems to work for me. it doesn't quit from any of the applications. (tried it in safari, firefox and a other apps)
    command w doesn't close the tab. command n doesn't open a new window and the list goes on.
    command a does work! selects all in the page.
    the keys are all good, nothing wrong with the keyboard.
    what/where can i check for the default behavior of these keys? i've tried resetting to defaults in the keyboard shortcuts under 'system preferences'.
    help!

    hmm, that's not it. thanks for your reply though.
    i've switched to other programs (using command tab) and it doesn't work.
    for example, right now, i have 'terminal', firefox, safari (and finder) running. i've switched to each of these programs and command q doesn't quit any of them. something is definitely hosed up.

  • Java command line purge not working after applying MLR 10

    Hi Gurus,
    After applying the latest patch MLR 10,
    java command line purge does not seem to work. I'm using the command
    java -ms1024M -mx1024M oracle.tip.repos.purge.PurgeManager purgeRuntime -start 07-APR-2009 -end 22-MAY-2009 Complete
    Before running the command i have set the environment using setenv.bat present in ip\install directory.
    Below error is observed when trying to purge the messages
    java -ms1024M -mx1024M oracle.tip.repos.purge
    .PurgeManager purgeRuntime -start 07-APR-2009 -end 22-MAY-2009 Complete
    Purge started, please wait...
    Purge failed
    Error -: AIP-11016: SQL error: java.sql.SQLException: ORA-06550: line 1, colum
    n 7:
    PLS-00905: object B2B.PURGE_RUNTIME is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.tip.repos.purge.PurgeManager.main(PurgeManager.java:1454)
    Caused by: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00905: object B2B.PURGE_RUNTIME is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
    :124)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:315)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:281)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:638)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.
    java:183)
    at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableS
    tatement.java:872)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
    nt.java:1085)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePrep
    aredStatement.java:2983)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
    edStatement.java:3056)
    at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallab
    leStatement.java:4295)
    at oracle.tip.repos.purge.PurgeManager.main(PurgeManager.java:1449)
    Kindly let me know if any post install scripts needs to be run ?
    Or is there any thing else i have missed.
    Thanks in advance,
    Regards,
    Cema
    Edited by: Cema on May 22, 2009 12:14 PM

    Hi Cema,
    In MLR 10 these two bugs have been added with others (you can see in patch read me file)-
    8432093 - AUTOMATE THE POST PATCH INSTRUCTION SCRIPTS FROM MLR 10 ONWARDS
    8339176 - B2B PURGE_RUNTIME PROCEDURE DOES NOT DELETE ALL TIP_WIREMESSAGE_RT RECORDS
    Bug 8432093 tells clearly that there is no need of running any post installation script from MLR 10 onwards, so you have not missed anything like post installation script.
    Bug 8339176 has addressed the PURGE_RUNTIME functionality for deleting messages. From your earlier posts it seems that you got some errors while applying this patch. Please make sure that patch is successfully installed on your system.
    Regards,
    Anuj

Maybe you are looking for

  • Best App. to Make Buttons, etc. w/Different Looks for 'onmouseover' etc.

    Hello, I'm making a simple 6 page site using DW for a class. I want the navagational buttons to have some flair. I can't code yet, but am learning. I have soo many tools I don't know which to use. Flash? PS and Image Ready? Ill. ? The site is my enti

  • Error in parked invoice document - Error in routine MRM-DRSEG_CR_CREATE

    Hi... I have parked a invoice document against a Service entry sheet. The invoice document has been parked but when going to MIR4 in change mode system is throwing an error message pop as Error in routine MRM-DRSEG_CR_CREATE. The SES which has been c

  • Report -without inner join

    hi, this is report i created in this i used two tables and used inner join to make relation b/t these tables... so my doubt is ..if we r using three diff.. tables without inner join we can do this report ......if u can.. plz can u show me wit example

  • How to design the activate page in JSF?

    When user register in our site, we will send an activate email with embedded url something like that: http://localhost:8080/eshop/faces/activate.jsp?auth=Q849+kMSA2XSThYHJHJHsYUI When user click the url, we will get the parameter auth and set the fla

  • Trying to sync ipad with iphone.. how do i get app content to be backed up to icloud?

    Am  new to Apple.. I was able to get the app I want to appear on my iphone, but the content is not there.  Same for my ibooks; PDFs i downloaded on ipad are not visible on my iphone. help? (iphone 4s, ipad 2)