将 hadoop执行job命令写到shell脚本中。类似 hadoop jar x.jar ×××.MainClassName inputPath outputPath这种命令。
hadoop客户机在本地,使用 Process执行shell脚本,java执行本地shell脚本的代码
1
2
3
4
Process process =null;
String command1 = " ./test.sh";
process = Runtime.getRuntime().exec(command1);
process.waitFor();
3.hadoop 在远程服务器上,java可以使用SSH连接远程服务器执行shell脚本。需要借助第三方jar包实现,常用的是ganymed-ssh2-build210.jar,网上有很多例子。
}
int main(){
int num = 11111;
printf("int:%ld/n",sizeof(int));
char num_char[100];
char num_char_b64[200];
memset(num_char,'/0',100);
memcpy(num_char,&num,4);
printf("content_to_be_encoded:%s/n",num_char);
int len = encode(num_char,4,num_char_b64);
printf("content_encoded:%s/n",num_char_b64);
int len2= decode(num_char_b64,len,num_char);
printf("%s/n",num_char);
memcpy(&num,num_char,4);
printf("int:%d/n",num);
}