Runtime.getRuntime().exec(java test)

Hi,
As part of a thesis for college, I am trying to execute a test java program. The program executes okay and I can read the results okay.
Sample code.
process = Runtime.getRuntime().exec("java test");
InputStream iOutStream = process.getInputStream();
InputStream ErrorStream = process.getErrorStream();
However, I need to be able to execute a progam that reads a parameter from the screen. I tried to pass a parameter file but it doesn't work.
process = Runtime.getRuntime().exec("java test <input.txt");
I also tried just passing the parameters as a string array but it doesn't work either.
process = Runtime.getRuntime().exec("java test 2, 2");
Is there any other way that I can get the process to accept parameters?
My deadline is looming so any help would be greatly appreciated.
Thanks
Eleanor
[email protected]

I think you are waiting when reading the output before you write to the stream until it becomes NULL or -1. That will never finish if the program you execute is expecting input!
See a working example:
This class does nothing than print a line on the console, then waits for a line of input, then prints the result again on the console. This is the class you'd execute from some other java code:
import java.io.*;
public class Input {
    public static void main(String args[]) {
        try {
            System.out.println("Before input");
            BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
            String s=r.readLine();
            System.out.println("Got line : " + s);
        } catch(Exception e) {
                System.out.println(e.getMessage());
}The following 'controls' the input-test class above, so compile the classes and execute the following one:
import java.io.*;
import java.lang.*;
public class test {
    public static void main(String args[]) {
        try {
            Process p = Runtime.getRuntime().exec("java Input");
            BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
            BufferedWriter w = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
            String s=r.readLine(); // You cannot read until NULL because that will not happen before you have 'input' something
            System.out.println("Got: " + s);
            w.write("cvxcvxcvx\n\r");
            w.flush();
            System.out.println("waiting result:");
            while( (s=r.readLine()) != null) { // read until finished.
                System.out.println("after : " + s);
        } catch(Exception e) {
                System.out.println(e.getMessage());               
}

Similar Messages

  • Runtime.getRuntime().exec(java method); - Passing strings between methods

    Hi all,
    I am using Runtime.getRuntime().exec(java xxxxxx); to run a java program from within a java program, i also need to pass a string to the new program. Does anyone know how to do this?
    Matt

    how would i retrive those strings in myApp as i want
    to put the values from them in a JLabelYou have a main method like this, right?
    public static void main(String[] args) { ... }
    args contains the array of strings passed to the app from the command line.

  • Pls help me about Runtime.getRuntime().exec("java...")

    I have two applications. One is Client, the other is Platform.
    In the Platform, there are source files packaged into a library named ZtConfig.jar used by Client. If run Client and Platform, two applications can execute normally.
    But if Client is started by user from platform, there is something wrong.
    I noticed the error difficultly with finally catching exception.
    I was puzzled. It is so strange. Pls help me. I list some codes here.
    In Client where finally exception catched:
    import zt.config;
            try {
              xmlFileUrl = new java.net.URL(
                  "file:///e:/Client/src/config/nsr1000.xml");
            catch (IOException ex1) {
              FileLogger.error(ex1.getMessage());
            FileLogger.info("NSR1000Document.setIEDContent", xmlFileUrl.toString());
            try {
              xmlLoader = new XMLConfigLoader(xmlFileUrl);
            finally {
              FileLogger.error("NSR1000Document.setIEDContent",
                               "cannot new XMLConfigLoader object");
              return; // the following codes cannot execute, so have to return here.
    In the XMLConfigLoader, the constructor is
      public XMLConfigLoader(java.net.URL xmlFileUrl) {
        this.xmlFileUrl = xmlFileUrl;
        configDoc = null;
        builder = null;
        xmlDoc = null;
    Platform start Client application using the following code
      Runtime.getRuntime().exec(
                    "java -jar e:/Client/Client.jar");

    I've got it!
    Briefly, it is because classpath setting was overwritten by JBuilder.
    Firstly, I start Platform from JBuilder. In its messages window. The command is
    d:\j2sdk1.4.2_06\bin\javaw -classpath "JBPATH" zt.client.nsr1000.NSR1000App
    Now, classpath environment variable was changed to be JBPATH. While I start
    Client use Runtime.getRuntime().exec("java -jar Client.jar"), it will not run for classpath changed.
    Then, I configured all packages used by Client into JBuilder libraries, including
    Client.jar. And changed codes Runtime.getRuntime().exec("java -jar Client.jar") to be Runtime.getRuntime().exec("java -Xmx128m zt.client.nsr1000.NSR1000App")
    I also changed CLASSPATH windows system environment variable.
    I found this from command console, it can display exceptions. But from JBuilder, there is no exception that can be captured. So debug is difficult.

  • Output of Process p=Runtime.getRuntime().exec("java filename

    Runtime r=Runtime.getRuntime();
    Process p=r.exec("java <filename>");
    on implementing this code no exception is fired
    nor there is any output on console window rather the console window
    doesn't open.
    can anyone help
    2nd question:
    Runtime r=Runtime.getRuntime();
    Process p=r.exec("cmd.exe dir");
    on executing it in windows xp it shows cannot open 16-bit windows application

    Runtime r=Runtime.getRuntime();
    Process p=r.exec("java <filename>");
    InputStream is = p.getInputStream();The standard output stream of the programm, you are starting, is the input stream of your process.

  • Kill "runtime.getruntime().exec"-generated processes with control-c?

    Hi there,
    In my java program I create 2 processes with "runtime.getruntime().exec", but when I stop my java program pressing control-c these 2 processes remains running and I have to kill them using linux command "kill".
    How can I program my code in order to kill these 2 processes when stopping my java program with control-c?
    I tried next but it didn't work for me:
            try {
    final Process proc = Runtime.getRuntime().exec ( "java ControlCProblemDemo" );
    Runtime.getRuntime().addShutdownHook(
    new Thread(){
    public void run(){
    proc.destroy();
    while ( true );
    } catch( IOException ioe ) {
    System.err.println( ioe );
    }Thank you very much in advance.
    Josu&eacute;

    so are you saying proc.destroy() does nothing?
    are you sure it's getting executed?
    is there an error?
    too little info here

  • Runtime.getRuntime().exec() and java.io.FilePermission

    Hi all.
    I'm trying to run the following code, in an JSP file, inside an Tomcat installation, with Security Manager activated:
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("arp -n -a");But, when I run the JSP, I receive the following error:
    java.security.AccessControlException: access denied (java.io.FilePermission <> execute)I have the following config. file:
    grant {
      permission java.io.FilePermission "/etc/intranet/intranet.properties", "read";
      permission java.io.FilePermission "/home/projetos/Shofar/conf/ShofarParameters.xml", "read";
      permission java.io.FilePermission "arp", "execute";
      permission java.net.SocketPermission "*:5432",   "accept,connect";
      permission java.lang.RuntimePermission  "selectorProvider";
      permission java.util.PropertyPermission "dns.server",        "read";
      permission java.util.PropertyPermission "dns.search",        "read";
      permission java.net.SocketPermission    "*",                 "resolve";
      permission java.net.SocketPermission    "*:53",              "accept,connect,resolve";
      permission java.io.FilePermission       "/etc/resolv.conf",  "read";
      permission java.net.SocketPermission        "127.0.0.1:465",                                                     "resolve,connect";
      permission java.util.PropertyPermission     "user.name",                                                         "read";
      permission java.io.FilePermission           "/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/javamail.providers",   "read";
      permission java.io.FilePermission           "/usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/lib/javamail.address.map", "read";
      permission java.security.SecurityPermission "insertProvider.SunJSSE";
      permission java.util.logging.LoggingPermission "control";
      permission java.util.PropertyPermission "java.awt.headless", "read";
      permission java.io.FilePermission "/tmp/-",                  "read,write,delete";
      permission java.io.FilePermission "/var/lib/tomcat5/temp",   "read";
      permission java.io.FilePermission "/var/lib/tomcat5/temp/-", "read,write,delete";
      permission java.io.FilePermission "/var/lib/tomcat5/work/-", "read,write,delete";
      permission java.util.PropertyPermission "java.io.tmpdir",    "read,write";
      permission java.lang.RuntimePermission "accessClassInPackage.sun.util.calendar";
      permission java.lang.RuntimePermission "accessDeclaredMembers";
      permission java.lang.RuntimePermission "suppressAccessChecks";
      permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper";
      permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
    };As seen, I put the permission java.io.FilePermission "/usr/sbin/arp", "execute"; line, but it don't work.
    What I need to put in the file?

    paulcw is right on the money on that one. You can easily create a bat file to perform that operation for you. However if you are feeling a little adventurous you can always use a Process:
    Process process=Runtime.getRuntime().exec(.....);
    int oneChar;
    InputStream inputStream=process.getInputStream();
    File file=new File("test.txt");
    try{
    file.createNewFile();
    } catch (Exception e){}
    FileOutputStream outputStream=new FileOutputStream(file);
    while ((oneChar=inputStream.read())!=-1){
    outputStream.write(oneChar);

  • How to get return value from Java runtime.getRuntime.exec?

    I'm running shell commands from an Oracle db (11gr2) on aix.
    But, I would like to get a return value from a shell comand... like you get with "echo $?"
    I use a code like
    CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
    import java.io.*;
    public class Host {
      public static int executeCommand(String command) {
        int retval=0;
        try {
            String[] finalCommand;
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
       catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
          retval=-1;
        return retval;
    /but I do not get a return value... because I don't know how to get return value..
    Edited by: user9158455 on 22-Sep-2010 07:33

    Hi,
    Have your tried pr.exitValue() ?
    I think you also need a finally block that destroys the subprocess
    Regards
    Peter

  • Running curl command from a java program using Runtime.getRuntime.exec

    for some reason my curl command does not run when I run it from within my java program and errors out with "https protocol not supported". This same curl command however runs fine from any directory on my red hat linux system.
    To debug the problem, I printed my curl command from the java program before calling Runtime.getRuntime.exec command and then used this o/p to run from the command line and it runs fine.
    I am not using libcurl or anything else, I am running a simple curl command as a command line utility from inside a Java program.
    Any ideas on why this might be happening?

    thanks a lot for your response. The reason why I am using curl is because I need to use certificates and keys to gain access to the internal server. So I use curl "<url> --cert <path to the certificate>" --key "<path to the key>". If you don't mid could you please tell me which version of curl you are using.
    I am using 7.15 in my system.
    Below is the code which errors out.
    public int execCurlCmd(String command)
              String s = null;
              try {
                  // run the Unix "ps -ef" command
                     Process p = Runtime.getRuntime().exec(command);
                     BufferedReader stdInput = new BufferedReader(new
                          InputStreamReader(p.getInputStream()));
                     BufferedReader stdError = new BufferedReader(new
                          InputStreamReader(p.getErrorStream()));
                     // read the output from the command
                     System.out.println("Here is the standard output of the command:\n");
                     while ((s = stdInput.readLine()) != null) {
                         System.out.println(s);
                     // read any errors from the attempted command
                     System.out.println("Here is the standard error of the command (if any):\n");
                     while ((s = stdError.readLine()) != null) {
                         System.out.println(s);
                     return(0);
                 catch (IOException e) {
                     System.out.println("exception happened - here's what I know: ");
                     e.printStackTrace();
                     return(-1);
         }

  • Runtime.getRuntime.exec() not working when Tomcat is made a windows Sevice

    Hi,
    I am working on a web application which launches a exe file on subitting the form. I am using Apache Tomcat 4.0.6 to run the web application. Initially Tomcat was not made a windows service on my machine and when I launch an exe it is launching without any problems. I used the following command to launch the exe file:
    <code>
    Process p = Runtime.getRuntime().exec("C:\\Program Files\\Mercury Interactive\\WinRunner\\arch\\wrun.exe" + strWROptions);
    </code>
    The above command launches WinRunner on the local machine.
    without using tomcat if I just compile and run a test program with this command, the exe is launching perfectly. But, Once I made tomcat a windows service on my machine the exe is not launching.
    Also, a process is being created in the windows task bar named wrun.exe once I submit the form but WinRunner is not lauching on the desktop.
    Can any one please help and suggest me.
    Thanks,
    Ramesh

    The version of Java I am using is 1.4.2. Even without
    using the string array as you mentioned, the exe
    (wrun.exe) is launched on my desktop if I don't run
    Tomcat as a windows service. But the problem arises on
    making it a service :-(
    That is strange because going by the documentation what you have been using should never work. I can't test it though, I'm not on MSWindows at the moment..
    Now, when I use this string array convention, I am
    getting an error saying "The tool could not launch..
    some error occured".
    That's not a Java error message, it must come from WinRunner. This means that you have succesfully started WinRunner (great!) but something else is wrong; maybe the parameters you pass to it are incorrect.
    How would you run it on the command line? Like this?wrun -t "D:\L5_QE\L5A\Initial" -create_text_report on -runThat line executes the wrun program and passes it five parameters, not three. The first parameter is "-t", the second "D:\L5_QE\L5A\Initial", the third "-create_text_report", the fourth "on", and the fifth "-run". The array of strings that corresponds to that line isString[] command = {"C:\\Program Files\\Mercury Interactive\\WinRunner\\arch\\wrun.exe",
                    "-t", "D:\\L5_QE\\L5A\\Initial",
                    "-create_text_report", "on",
                    "-run"};

  • Problems with Runtime.getRuntime().exec in Windows 2000

    Hello,
    I have a batch file that I want to run from my java application. My code is the following:
    try {
            Runtime.getRuntime().exec("cmd.exe /c C:\\temp\\shortcut.bat");
    } catch (Exception e) {
         System.out.println(e.getMessage());
    }I was developing on windows XP and it worked just fine. But then I tested it on windows 2000 and it didn't work. The batch file is okay, because if I run the batch file myself it works just fine, even from the command line. I get no errors what so ever, it just doesn't do anything...
    Can somebody help me with this?
    thx in advance

    thank you all so much
    I figured it out... It was a combination of two things that went wrong.
    First one: in my batch file I had:
    cd C:\tempwhich worsk fine in XP, but in it doesn't in 2000. In 2000 it has to be:
    C:
    cd \temp But just changing that wasn't enough, I also needed the "start"
    Now it works just fine on 2000, hopefully it'll still work on xp as well.
    THX!

  • Inconsistent exit code from Runtime.getRuntime().exec

    I'm getting non-deterministic behavior from a call to a native process. Here is the code:
    public class Test {
    public static void main (String[] pArgs) {
    try {
    String cmd[] = { "cmp", "-s",
    pArgs[0],
    pArgs[1] };
    System.err.println("running command: ");
    Process p = Runtime.getRuntime().exec(cmd);
    System.err.println("getting exitcode...");
    int exitcode = p.waitFor();
    System.err.println(exitcode);
    System.err.println(p.exitValue());
    } catch(Exception e) {
    System.err.println("Caught exception while executing cmd");
    e.printStackTrace();
    And here is the output:
    bock@homeruns[~/work/index]10:08> java Test output output.old
    running command:
    getting exitcode...
    0
    0
    bock@homeruns[~/work/index]10:08> java Test output output.old
    running command:
    getting exitcode...
    1
    1
    bock@homeruns[~/work/index]10:08> java Test output output.old
    running command:
    getting exitcode...
    0
    0
    they should all be 1's because the files are different. when i run it on the command line i get:
    bock@homeruns[~/work/index]10:13> cmp -s output output.old ; echo $?
    1
    any help would definitely be appreciated!
    thanks,
    roger

    thanks for the link. i read through it but it doesn't seem to address why the exit code would be inconsistently reported. the other problems described by that link don't seem to apply to this case because i have not experienced hanging and there is no standard input, standard output, or standard error associated with "cmp -s" - all it does is return the appropriate exit code.
    should i be reporting this as a bug to sun? up till recently i've been assuming it was a problem with my code but now i'm not so sure...

  • Runtime.getRuntime().exec works on windows failed on linux!

    Hi,
    I'm trying to execute a linux command from java 1.4.2 using Runtime.getRuntime().exec(). The linux command produces output and write to a file in my home dir. The command runs interactively in the shell and also run on windows.
    The command is actually a mozilla pk12util. My java code to run this pk12util works on windows, but not on linux (fedora). When I print out the command I'm trying to run in java, I can run it interactively in bash shell.
    Method below is where the problem seems to be:
    public void writeCert() {
    // Declaring variables
    System.out.println("Entering writeCert method");
    String command = null;
    certFile = new File(credFileName);
    // building the command for either Linux or Windows
    if (System.getProperty("os.name").equals("Linux")) {
    command = linuxPathPrefix + File.separator + "pk12util -o "
    + credFileName + " -n \"" + nickName + "\" -d "
    + dbDirectory + " -K " + slotpw + " -w " + slotpw + " -W "
    + pk12pw;
    System.out.println("System type is linux.");
    System.out.println("Command is: " + command);
    if (System.getProperty("os.name").indexOf("Windows") != -1) {
    // command = pk12utilLoc + File.separator + "pk12util -o
    // "+credFileName+" -n "\"+nickname+\"" -d \""+dbDirectory+"\" -K
    // "+pk12pw+" -w "+pk12pw+" -W "+pk12pw;
    command = pk12utilLoc + File.separator + "pk12util.exe -o "
    + credFileName + " -n \"" + nickName + "\" -d "
    + dbDirectory + " -K " + slotpw + " -w " + slotpw + " -W "
    + pk12pw;
    System.out.println("System type is windows.");
    System.out.println("Command is: " + command);
    // If the system is neither Linux or Windows, throw exception
    if (command == null) {
    System.out.println("command equals null");
    try {
    throw new Exception("Can't identify OS");
    } catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    // Having built the command, running it with Runtime.exec
    File f = new File(credFileName);
    // setting up process, getting readers and writers
    Process extraction = null;
    BufferedOutputStream writeCred = null;
    // executing command - note -o option does not create output
    // file, or write anything to it, for Linux
    try {
    extraction = Runtime.getRuntime().exec(command);
    } catch (IOException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    // Dealing with the the output of the command; think -o
    // option in command should just write the credential but dealing with output anyway
    BufferedWriter CredentialOut = null;
    OutputStream line;
    try {
    CredentialOut = new BufferedWriter (
    new OutputStreamWriter(
    new FileOutputStream(credFileName)));
    catch (FileNotFoundException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    // writing out the output; currently having problems because I am trying to run
    }

    My error is due to the nickname "-n <nickname" parameter error. I think the problem is having a double quotes around my nickname, but if I take out the double quotes around my nickname "Jana Test's ID" won't work either because there are spaces between the String. Error below:
    Command is: /usr/bin/pk12util -o jtest.p12 -n "Jana Test's Development ID" -d /home/jnguyen/.mozilla/firefox/zdpsq44v.default -K test123 -w test123 -W test123
    Read from standard outputStreamjava.io.PrintStream@19821f
    Read from error stream: "pk12util: find user certs from nickname failed: security library: bad database."
    null
    java.lang.NullPointerException
    at ExtractCert.writeCert(ExtractCert.java:260)
    at ExtractCert.main(ExtractCert.java:302)
    Code is:
    private String nickName = null;
    private void setNickname(String nicknameIn) {
    nickName = nicknameIn;
    // building the command for either Linux or Windows
    if (System.getProperty("os.name").equals("Linux")) {
    command = linuxPathPrefix + File.separator + "pk12util -o " + credFileName + " -n \"" + nickName + "\" -d " + dbDirectory + " -K " + slotpw + " -w " + slotpw + " -W " + pk12pw;
    System.out.println("System type is linux.");
    System.out.println("Command is: " + command);
    extraction = Runtime.getRuntime().exec(command);
    BufferedReader br = new BufferedReader(
    new
    InputStreamReader(extraction.getErrorStream()));
    PrintStream p = new PrintStream(extraction.getOutputStream());
    System.out.println("Read from standard outputStream" + p);

  • Runtime.getRuntime().exec() problem while getting Mozilla version.

    Hi all,
    I've trying to get the current mozilla version in Java side using
    Runtime.getRuntime().exec(). The sample code is as below.
    I've tested two cases using exec(), as case# 1 and case# 2.
    The result is after the code.
    try
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(new String[] {"mozilla", "-remote"}); //case# 1
    //Process proc = rt.exec(new String[] {"mozilla", "-version"}); //case# 2
    InputStream stderr = proc.getErrorStream();
    InputStreamReader isr = new InputStreamReader(stderr);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    System.out.println("<ERROR>");
    while ( (line = br.readLine()) != null)
    System.out.println(line);
    System.out.println("</ERROR>");
    int exitVal = proc.waitFor();
    System.out.println("Process exitValue: " + exitVal);
    } catch (Throwable t) {
    t.printStackTrace();
    // execute "mozilla -remote"(case# 1)
    $ java TestExec
    <ERROR>
    -remote requires an argument
    </ERROR>
    Process exitValue: 1
    // execute "mozilla -version"(case# 2)
    $ java TestExec
    <ERROR>
    </ERROR>
    Process exitValue: 0
    I'm just surprised that why case# 2 couldn't get the returned version string as case #1 ? Since there will be version string be returned from command line:
    $ mozilla -version
    Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830, build 2002083014
    Could anybody explain the problem or give any solution ?
    Thanks.
    -George.

    Hi all,
    One more question here.
    While I use Runtime.getRuntime().exec() to execute some commands,
    the commands may fail for some reason. Generally, they will return with the exit
    value set to 1 or others. But sometime, before waitFor() exits, there is a popped up
    dialog giving some info, and only after I click the "OK" button, it dispears, and
    waitFor() returns the exit value.
    So I'm not sure that could I suppress this popped up dialog, and make it run
    just like other commands ? I mean, just get the exit value by waitFor() without user
    interferance ?
    Thanks.
    -George.

  • Runtime.getRuntime.exec(cmd) - 'out of space'

    And helpful suggestions from the Java / AIX boffins out there would be appreciated.
    System: AIX 4.3 jdk 1.3.1
    Briefly, I am attempting to invoke the ibm 'c' compiler from within a java program.
    The command:-
    p = Runtime.getRuntime.exec("/usr/ibmcxx/bin/cc test.c")
    returns the os error 'mmap failed: Not enough space'
    other commands that do work:-
    p = Runtime.getRuntime.exec("ls -l")
    return successfully without error
    p = Runtime.getRuntime.exec("/usr/ibmcxx/bin/cc Notfound.c")
    raises the error '/usr/ibmcxx/bin/cc 1501-288 input file NotFound.c not found' - as expected.
    Additionally:-
    I have tried invoking the program with the -msnnM & -mxnnM flags set to large values.
    /usr/ibmcxx/bin/cc test.c : works happily from the command line.
    cheers
    John.

    Thanks but not made any difference.
    keep those ideas coming!
    Does any body 'real' understand how the getRuntime() interacts with the underlying OS? I assume that the "mmap failed" is coming from the compiler rather then the JVM. But does it throw this error only when run through the JVM ?
    John.

  • Runtime.getruntime().exec and text

    I have an application called Truck Scale. This application has a requirement to talk with devices such as a scale indicator, zebra printer, message boards, rf readers and okidata 395 printers. In this application, we have these devices hooked to a serial mux such as a digi and we are using the JAVA COMM API. However, we are having issues with java comm api where all the data that should be transmitted to the port is not being transmitted. We can however transmitt correctly to the port using the unix shell. I would like to forgo using the Java Comm API and execute everything that needs to send or read info for a port via the unix shell. I know I can do this using the runtime.getruntime().exec. However, my issue arises with oki395. The output that needs to be send via the port (not using lp due to overhead of the unix spooler), is formatted text. When I pass the unix command, the formatted text, and my port to the runtime enviornment via the String array, my formatted text loose all of its formatting including newlines. How can I address this issue with the runtime.getruntime().exec.

    Yes, I can send a new line the port correctly from a command line.
    Here is an example of the text file.
    CROSS PLAINS TN 37049 2549
    MATERIAL SPREAD NOT GUARNTEED.NO PERSONAL CHECKS..
    615-654-9942 TOLL FREE 877-654-9942
    Date: 07/21/2009 02:47:31
    Job No: TC1
    Q Num::
    Cust No: 37206728 Src Num::
    Sold To: CROSS PLAINS UNITED METHODIST CHURCH
    Address: 7665 HIGHWAY 25 E
    CROSS PLAINS,TN 37049
    Ord By:
    Ord No: Rate Zone:
    Location: testing changes
    This text is build using a class we created called textTicket which has each line define as a string with the appropriate newlines and tabs on eac line. As soon as this object is added to the string array and is passed to exec to execute the unix command to pipe it out to the port, the textTicket loses its formatting.

Maybe you are looking for

  • Aio remote update copy

    Been using the aio app for sometime now with no problems, very happy! But.....the latest upgrade seems no longer to have a simple "photocopy" function, used it a lot in the past...simple! Now it seems I have to do scan or photograph and then fiddle w

  • 10.5.1 Broken Mail Server - virtual host configuration

    Hi, I have been trying to set up my mail server (new 10.5.1 build) to run with virtual hosts. I read pterobyte's tutorial ( Making Virtual Mail Users in OS X 10.4/10.5 Server) and implemented his suggested workarounds. However, it doesn't seem to hav

  • My BB Torch can't make a call via VIBER

    Dear Team, Kindly assist me, when did i try to make call (Viber to Viber) via my BB device I can't able to do this. Majority says BB isn't support voice call on VIBER. Is there any future upgradation are coming in BB IOS or any other version is requi

  • Discounts in APP

    Hello, We have an issue in APP. Discounts have to be removed manually on credits and also the discount here is calculated on the local currency rather than on the document currency but upon drilling down, the discount appears to be correct on the det

  • ABAP Query for Asset Reporting - Error in generating Infoset

    Hi friends, While generating Infoset - for the SAP standad infoset (SAPQUERY/AM01 -FIAA - Inventory information)-I am getting an Error as "The field "BERDATUM" is unknown, but there is a field with the similar name". I am unable to resolve the error.