rcc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/usr/bin/env bash
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # The Hadoop record compiler
  17. #
  18. # Environment Variables
  19. #
  20. # JAVA_HOME The java implementation to use. Overrides JAVA_HOME.
  21. #
  22. # HADOOP_OPTS Extra Java runtime options.
  23. #
  24. # HADOOP_CONF_DIR Alternate conf dir. Default is ${HADOOP_HOME}/conf.
  25. #
  26. bin=`dirname "$0"`
  27. bin=`cd "$bin"; pwd`
  28. if [ -e "$bin/../libexec/hadoop-config.sh" ]; then
  29. . "$bin"/../libexec/hadoop-config.sh
  30. else
  31. . "$bin/hadoop-config.sh"
  32. fi
  33. if [ -f "${HADOOP_CONF_DIR}/hadoop-env.sh" ]; then
  34. . "${HADOOP_CONF_DIR}/hadoop-env.sh"
  35. fi
  36. # some Java parameters
  37. if [ "$JAVA_HOME" != "" ]; then
  38. #echo "run java in $JAVA_HOME"
  39. JAVA_HOME=$JAVA_HOME
  40. fi
  41. if [ "$JAVA_HOME" = "" ]; then
  42. echo "Error: JAVA_HOME is not set."
  43. exit 1
  44. fi
  45. JAVA=$JAVA_HOME/bin/java
  46. JAVA_HEAP_MAX=-Xmx1000m
  47. # CLASSPATH initially contains $HADOOP_CONF_DIR
  48. CLASSPATH="${HADOOP_CONF_DIR}"
  49. CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
  50. # for developers, add Hadoop classes to CLASSPATH
  51. if [ -d "$HADOOP_HOME/build/classes" ]; then
  52. CLASSPATH=${CLASSPATH}:$HADOOP_HOME/build/classes
  53. fi
  54. if [ -d "$HADOOP_HOME/build/webapps" ]; then
  55. CLASSPATH=${CLASSPATH}:$HADOOP_HOME/build
  56. fi
  57. if [ -d "$HADOOP_HOME/build/test/classes" ]; then
  58. CLASSPATH=${CLASSPATH}:$HADOOP_HOME/build/test/classes
  59. fi
  60. # so that filenames w/ spaces are handled correctly in loops below
  61. IFS=
  62. # for releases, add core hadoop jar & webapps to CLASSPATH
  63. if [ -d "$HADOOP_HOME/webapps" ]; then
  64. CLASSPATH=${CLASSPATH}:$HADOOP_HOME
  65. fi
  66. for f in $HADOOP_HOME/hadoop-core-*.jar; do
  67. CLASSPATH=${CLASSPATH}:$f;
  68. done
  69. # add libs to CLASSPATH
  70. for f in $HADOOP_HOME/lib/*.jar; do
  71. CLASSPATH=${CLASSPATH}:$f;
  72. done
  73. for f in $HADOOP_HOME/lib/jetty-ext/*.jar; do
  74. CLASSPATH=${CLASSPATH}:$f;
  75. done
  76. # restore ordinary behaviour
  77. unset IFS
  78. CLASS='org.apache.hadoop.record.compiler.generated.Rcc'
  79. # cygwin path translation
  80. if expr `uname` : 'CYGWIN*' > /dev/null; then
  81. CLASSPATH=`cygpath -p -w "$CLASSPATH"`
  82. fi
  83. # run it
  84. exec "$JAVA" $HADOOP_OPTS -classpath "$CLASSPATH" $CLASS "$@"