execvp()函数的问题
資深大佬 : zxCoder 5
#include <cstdio> #include <unistd.h> using namespace std; int main(){ char buf[80]; getcwd(buf,sizeof(buf)); printf("current working directory: %sn", buf); chdir("/home/keane/Judge/temp"); getcwd(buf,sizeof(buf)); printf("current working directory: %sn", buf); char *array[3]; array[0] = "java"; array[1] = "Main"; array[2] = NULL; execvp("java", array); return 0; }
输出路径显示已经切换目录过去了,而且下面也确实有 Main.class,但是我这样执行就显示错误: 找不到或无法加载主类 Main
求解
大佬有話說 (3)