这是错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/alicebot/server/net/AliceServer
Caused by: java.lang.ClassNotFoundException: org.alicebot.server.net.AliceServer
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
这是 server.sh 文件:
#!/bin/sh
echo Starting Jarvis Program D.
cd "`dirname \"$0\"`"
export ALICE_HOME=.
export SERVLET_LIB=lib/servlet.jar
export ALICE_LIB=lib/aliceserver.jar
export JS_LIB=lib/js.jar
# Set SQL_LIB to the location of your database driver.
export SQL_LIB=lib/mysql_comp.jar
# These are for Jetty; you will want to change these if you are using a different http server.
export HTTP_SERVER_LIBS=lib/org.mortbay.jetty.jar
export PROGRAMD_CLASSPATH=$SERVLET_LIB:$ALICE_LIB:$JS_LIB:$SQL_LIB:$HTTP_SERVER_LIBS
exec java -classpath $PROGRAMD_CLASSPATH -Xms64m -Xmx128m org.alicebot.server.net.AliceServer $1
这是 NSTask 代码:
NSString *shstring = [NSString stringWithFormat:
@"%@ %@ %@",
@"source",
@"server.sh",
@"| /usr/bin/sed '/Jarvis>/q'"
];
NSTask *sh = [NSTask new];
NSPipe *outputPipe = [NSPipe new];
[sh setLaunchPath:@"/bin/sh"];
[sh setArguments:[NSArray arrayWithObjects: @"-c", shstring, nil ]];
[sh setCurrentDirectoryPath:@"/applications/jarvis/brain"];
[sh setStandardInput:[NSPipe new]];
[sh setStandardError:outputPipe];
[sh setStandardOutput:outputPipe];
[sh launch];
NSMutableString *outputString = [NSMutableString string];
while ([outputString rangeOfString:@"Jarvis>"].location == NSNotFound) {
[outputString appendString:[[[NSString alloc] initWithData:[[outputPipe fileHandleForReading] readDataToEndOfFile] encoding:NSUTF8StringEncoding] autorelease]];
NSRunAlertPanel(@"", outputString, @"", @"", @"");
}
每当我通过 NSTask 运行此脚本并检查错误管道时,就会出现该错误并且仅打印回显。
有任何想法吗?