Results 1 to 2 of 2
  1. #1

    Member Since
    Mar 26, 2009
    java.lang.Runtime.exec fails on Mac
    Hi folks;
    I am developing a java program that needs to run commands as if it were from command line. I have a binary in /Applications/LabPrints/Image Aligner/LabPrints.dalp
    and when I run it from command line, it runs but when I try to run it form Java with
    String cmd="\"/Applications/LabPrints/Image Aligner/LabPrints.dalp\"";
    Runtime.exec(new String[]{cmd});
    I get an error with the output: "/Applications/LabPrints/Image Aligner/LabPrints.dalp": not found
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(
    at java.lang.Runtime.exec(
    at java.lang.Runtime.exec(
    at krs.MainClass.main(
    Does anyone has any idea what I am missing? I am running the same on PC and it runs perfectly. I am also capturing the output and error streams of the created process in separate threads.

    Thanks in advance...

  2. #2

    Member Since
    Mar 28, 2009
    Try sending the command without the escaped quotes. The quotes are just to help the terminal identify the application path as a single argument. But when you send it with the quotes through the exec() method, it thinks the quotes are part of the filename.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. New I-Mac Issue re: Java Runtime Environment
    By michaels39301 in forum OS X - Operating System
    Replies: 2
    Last Post: 06-21-2015, 10:49 PM
  2. java.lang.ExceptionInInitializerError
    By bercayu in forum OS X - Operating System
    Replies: 0
    Last Post: 06-30-2012, 03:44 AM
  3. java.lang.outofmemoryerror:
    By the707 in forum OS X - Apps and Games
    Replies: 5
    Last Post: 11-09-2007, 07:00 PM
  4. java.lang.UnsatisfiedLinkError:
    By makemeli in forum OS X - Operating System
    Replies: 0
    Last Post: 09-21-2007, 08:23 PM
  5. Java 1.4.1/OS 10.2.3 runtime exec fails
    By pro3soft in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 01-22-2004, 09:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts