Monday, February 14, 2011

Running a Unix Executable Objective-C file in Java (OS X)

Programmer Question

I've seen this question asked before and tried following the solutions posted. Unfortunately, they aren't working. I'm trying to make a simple Java program that can run a compiled Objective-C program (Unix Executable file) with an input parameter. Below are the attempts at Java I have tried that don't seem to be working:



String[] cmd = {"/bin/bash", fullFilePath, Param};
Runtime.getRuntime().exec(cmd);


This is generating a Processor error of 126 for "Command invoked cannot execute". I've tried other variations that don't work as well such as:



String[] cmd = {"/bin/bash fullFilePath \"Param\""};
String[] cmd = {"/usr/bin/open fullFilePath \"Param\""};


Any suggestions or ideas on how I can get this to work? I just need to run the compiled Objective-C program in Java with the parameter. I figured it wouldn't be this hard. Thanks in advance, and if you need more information just ask.



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails