Browse Source

commit 908cb0ce1e984f2603d51bef634b3cae3466794d
Author: Yahoo\! <ltucker@yahoo-inc.com>
Date: Thu Sep 24 16:08:33 2009 -0700

HADOOP-5976. Add a new command, classpath, to the hadoop script. Contributed by Owen O'Malley and Gary Murry

from: http://issues.apache.org/jira/secure/attachment/12420325/script.patch

+++ b/YAHOO-CHANGES.txt
+56. HADOOP-5976. Add a new command, classpath, to the hadoop
+ script. Contributed by Owen O'Malley and Gary Murry
+


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20-security-patches@1077004 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley 14 years ago
parent
commit
65b7da613d
2 changed files with 18 additions and 1 deletions
  1. 9 1
      bin/hadoop
  2. 9 0
      src/docs/src/documentation/content/xdocs/commands_manual.xml

+ 9 - 1
bin/hadoop

@@ -73,6 +73,8 @@ if [ $# = 0 ]; then
   echo "  jar <jar>            run a jar file"
   echo "  distcp <srcurl> <desturl> copy file or directories recursively"
   echo "  archive -archiveName NAME <src>* <dest> create a hadoop archive"
+  echo "  classpath            prints the class path needed to get the"
+  echo "                       Hadoop jar and the required libraries"
   echo "  daemonlog            get/set the log level for each daemon"
   echo " or"
   echo "  CLASSNAME            run the class named CLASSNAME"
@@ -182,7 +184,13 @@ fi
 unset IFS
 
 # figure out which class to run
-if [ "$COMMAND" = "namenode" ] ; then
+if [ "$COMMAND" = "classpath" ] ; then
+  if $cygwin; then
+    CLASSPATH=`cygpath -p -w "$CLASSPATH"`
+  fi
+  echo $CLASSPATH
+  exit
+elif [ "$COMMAND" = "namenode" ] ; then
   CLASS='org.apache.hadoop.hdfs.server.namenode.NameNode'
   HADOOP_OPTS="$HADOOP_OPTS $HADOOP_NAMENODE_OPTS"
 elif [ "$COMMAND" = "secondarynamenode" ] ; then

+ 9 - 0
src/docs/src/documentation/content/xdocs/commands_manual.xml

@@ -409,6 +409,15 @@
 					 Runs the class named CLASSNAME.
 				</p>
 			</section>
+			<section>
+				<title> classpath </title>
+				<p>
+					Prints the class path needed to get the Hadoop jar and the required libraries.
+				</p>
+				<p>
+					<code>Usage: hadoop classpath</code>
+				</p>
+			</section>
     </section>
 		<section>
 			<title> Administration Commands </title>