New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

java.lang.Runtime.exec fails on Mac

Post Reply New Thread Subscribe

Thread Tools

Member Since: Mar 26, 2009
Posts: 1
kamalsofteng is on a distinguished road

kamalsofteng is offline
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:

Quote: "/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...
QUOTE Thanks

Member Since: Mar 28, 2009
Posts: 2
mpcoder is on a distinguished road

mpcoder is offline
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.
QUOTE Thanks

Post Reply New Thread Subscribe

« Finding ANY file on OS X | Script for adding aiff extensions to huge amount of audio files »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
Who's got the most Macs? narf1899 Schweb's Lounge 139 11-24-2012 10:53 AM
Need to know how much RAM your Mac can hold? iLaugh Other Hardware and Peripherals 6 12-13-2009 01:49 PM
At my wits end with my Mac... christianhough Switcher Hangout 31 01-28-2009 09:32 PM
Has The Mac Been Hacked...... MaDDoG Apple Rumors and Reports 5 05-01-2007 07:06 PM
It's called a Mac iSheep Schweb's Lounge 22 10-13-2004 05:35 PM

All times are GMT -4. The time now is 06:15 AM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?