且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从HDFS FileSystem执行hadoop jar?

更新时间:2023-11-17 11:00:04

Looking at bin/hadoop script for Hadoop, for executing a jar file it uses this condition --

elif [ "$COMMAND" = "jar" ] ; then
  CLASS=org.apache.hadoop.util.RunJar

This says it uses RunJar class to execute the jar. If you see the RunJar class, the arguments supported are --

RunJar jarFile [mainClass] args...

where, jarFile is accessed using the following code inside RunJar Class--

int firstArg = 0;
String fileName = args[firstArg++];
File file = new File(fileName);

Hence, fileName points to jarFile, so fileName in my view cannot be a HDFS path as seen above, unless you are somehow able to mount the HDFS in your file system, so that it becomes accessible by the java File class.

相关阅读

推荐文章