There are several Java based Tomcat wrappers out there but I'm interested in building one in Cocoa. I started yesterday (went to bed pretty late) and so far I can read the Tomcat log files but I'm unable to start Tomcat -dough!
I need to set environment variables but how does one do this from Cocoa since NSTask is not binded to a specific shell. This means that I don't know if sentenv or export is the way to go. For the moment being neither of these is working.
Here's a snipplet:
// -----------------------------------
// this doesn't work
// -----------------------------------
commandStart =[[TaskWrapper alloc] initWithController:self arguments:[NSArray arrayWithObjects:@"/bin/sh", @"/Users/bido/Dev/bin/start_tomcat", nil]];
[commandStart startProcess];
// -----------------------------------
// this works as expected
// -----------------------------------
command=[[TaskWrapper alloc] initWithController:self arguments:[NSArray arrayWithObjects:@"/usr/bin/tail",@"-f",@"/usr/local/jakarta-tomcat-4.1.24/logs/catalina.out",nil]];
[command startProcess];
// -----------------------------------
I borrowed TaskWrapper(which returns an NSString and makes asynchronous system calls) from somewhere on the web and it works as expected.
Any ideas on how to set environment variables? I need to set JAVA_HOME and the CATALINA_HOME variables before starting Tomcat.
I realize that the above snipplet is not much to go on. But apart from TaskWrapper, the rest of the code is very common place and straightforward.
Thanks!
