Click here to Skip to main content
15,884,709 members
Home / Discussions / Objective-C and Swift
   

Objective-C and Swift

 
QuestionLaunch Safari from another app then Autofill username and password Pin
picardy8-Jan-15 8:45
picardy8-Jan-15 8:45 
AnswerRe: Launch Safari from another app then Autofill username and password Pin
Dennis E White27-Jan-15 5:11
professionalDennis E White27-Jan-15 5:11 
AnswerRe: Launch Safari from another app then Autofill username and password Pin
C3D130-Jan-15 3:46
professionalC3D130-Jan-15 3:46 
QuestionStart java program from Objective C code Pin
DraqueD5-Jan-15 8:42
DraqueD5-Jan-15 8:42 
AnswerRe: Start java program from Objective C code Pin
jschell5-Jan-15 9:37
jschell5-Jan-15 9:37 
GeneralRe: Start java program from Objective C code Pin
DraqueD5-Jan-15 9:52
DraqueD5-Jan-15 9:52 
AnswerRe: Start java program from Objective C code Pin
Richard MacCutchan5-Jan-15 22:39
mveRichard MacCutchan5-Jan-15 22:39 
GeneralRe: Start java program from Objective C code Pin
DraqueD6-Jan-15 5:04
DraqueD6-Jan-15 5:04 
Ah, I do see what I was doing there! I was fundamentally misunderstanding how java was being referenced. I almost have it working at this point! Here's the code as it stands now:

C#
int main(int argc, const char * argv[]) {
    NSFileManager *filemgr;
    NSString *currentpath;

    filemgr = [[NSFileManager alloc] init];

    currentpath = [filemgr currentDirectoryPath];

    NSPipe *pipe = [NSPipe pipe];
    NSFileHandle *file = pipe.fileHandleForReading;

    NSTask *task = [[NSTask alloc] init];
    task.launchPath = @"/usr/bin/java";
    task.arguments = @[@"-jar", [currentpath stringByAppendingString:@"/PolyGlot.jar"], [NSString stringWithFormat:@"%c", argv]];
    task.standardOutput = pipe;

    [task launch];

    NSData *data = [file readDataToEndOfFile];
    [file closeFile];

    NSString *grepOutput = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
    NSLog (@"grep returned:\n%@", grepOutput);

    return 0;
}


The only remaining problem is that the "-jar" argument seems to be ignored at this point. If I apply it by itself, Java recognizes it as an argument, but otherwise, it is only accepting "PolyGlot.jar". Is there something that I'm not doing correctly there?

Thanks for the help so far!
GeneralRe: Start java program from Objective C code Pin
Richard MacCutchan6-Jan-15 5:29
mveRichard MacCutchan6-Jan-15 5:29 
GeneralRe: Start java program from Objective C code Pin
DraqueD6-Jan-15 5:43
DraqueD6-Jan-15 5:43 
GeneralRe: Start java program from Objective C code Pin
Richard MacCutchan6-Jan-15 6:29
mveRichard MacCutchan6-Jan-15 6:29 
GeneralRe: Start java program from Objective C code Pin
DraqueD6-Jan-15 9:29
DraqueD6-Jan-15 9:29 
AnswerRe: Start java program from Objective C code Pin
seemajoshii27-Feb-15 1:22
seemajoshii27-Feb-15 1:22 
QuestionHow do I find Objective C developers? Pin
Waffleapp13-Dec-14 7:13
Waffleapp13-Dec-14 7:13 
QuestionIn objective-c I’m try to create a statement that toggles a variable Pin
Member 1125124020-Nov-14 11:02
Member 1125124020-Nov-14 11:02 
AnswerRe: In objective-c I’m try to create a statement that toggles a variable Pin
Richard MacCutchan20-Nov-14 21:56
mveRichard MacCutchan20-Nov-14 21:56 
QuestionDifference between C and Objective-C Pin
online visit9-Jun-14 19:32
online visit9-Jun-14 19:32 
AnswerRe: Difference between C and Objective-C Pin
future20159-Jun-14 20:57
future20159-Jun-14 20:57 
GeneralRe: Difference between C and Objective-C Pin
online visit9-Jun-14 21:31
online visit9-Jun-14 21:31 
AnswerRe: Difference between C and Objective-C Pin
Richard MacCutchan9-Jun-14 21:00
mveRichard MacCutchan9-Jun-14 21:00 
GeneralRe: Difference between C and Objective-C Pin
thatraja10-Jun-14 21:11
professionalthatraja10-Jun-14 21:11 
GeneralRe: Difference between C and Objective-C Pin
Richard MacCutchan10-Jun-14 21:28
mveRichard MacCutchan10-Jun-14 21:28 
GeneralRe: Difference between C and Objective-C Pin
thatraja10-Jun-14 21:42
professionalthatraja10-Jun-14 21:42 
GeneralRe: Difference between C and Objective-C Pin
Dennis E White11-Jun-14 4:24
professionalDennis E White11-Jun-14 4:24 
GeneralRe: Difference between C and Objective-C Pin
Richard MacCutchan11-Jun-14 5:53
mveRichard MacCutchan11-Jun-14 5:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.