45f8053be5
Instead of looking for a specially-named assembly, the scripts now will blindly add all jars under the libs directory to the classpath. This libs directory is still currently the old assembly dir, so things should keep working the same way as before until we make more packaging changes. The only lost feature is the detection of multiple assemblies; I consider that a minor nicety that only really affects few developers, so it's probably ok. Tested locally by running spark-shell; also did some minor Win32 testing (just made sure spark-shell started). Author: Marcelo Vanzin <vanzin@cloudera.com> Closes #11591 from vanzin/SPARK-13578.
65 lines
2.2 KiB
Batchfile
65 lines
2.2 KiB
Batchfile
@echo off
|
|
|
|
rem
|
|
rem Licensed to the Apache Software Foundation (ASF) under one or more
|
|
rem contributor license agreements. See the NOTICE file distributed with
|
|
rem this work for additional information regarding copyright ownership.
|
|
rem The ASF licenses this file to You under the Apache License, Version 2.0
|
|
rem (the "License"); you may not use this file except in compliance with
|
|
rem the License. You may obtain a copy of the License at
|
|
rem
|
|
rem http://www.apache.org/licenses/LICENSE-2.0
|
|
rem
|
|
rem Unless required by applicable law or agreed to in writing, software
|
|
rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
rem See the License for the specific language governing permissions and
|
|
rem limitations under the License.
|
|
rem
|
|
|
|
rem Figure out where the Spark framework is installed
|
|
set SPARK_HOME=%~dp0..
|
|
|
|
call "%SPARK_HOME%\bin\load-spark-env.cmd"
|
|
|
|
rem Test that an argument was given
|
|
if "x%1"=="x" (
|
|
echo Usage: spark-class ^<class^> [^<args^>]
|
|
exit /b 1
|
|
)
|
|
|
|
rem Find Spark jars.
|
|
rem TODO: change the directory name when Spark jars move from "lib".
|
|
if exist "%SPARK_HOME%\RELEASE" (
|
|
set SPARK_JARS_DIR="%SPARK_HOME%\lib"
|
|
) else (
|
|
set SPARK_JARS_DIR="%SPARK_HOME%\assembly\target\scala-%SPARK_SCALA_VERSION%"
|
|
)
|
|
|
|
if not exist "%SPARK_JARS_DIR%"\ (
|
|
echo Failed to find Spark assembly JAR.
|
|
echo You need to build Spark before running this program.
|
|
exit /b 1
|
|
)
|
|
|
|
set LAUNCH_CLASSPATH=%SPARK_JARS_DIR%\*
|
|
|
|
rem Add the launcher build dir to the classpath if requested.
|
|
if not "x%SPARK_PREPEND_CLASSES%"=="x" (
|
|
set LAUNCH_CLASSPATH="%SPARK_HOME%\launcher\target\scala-%SPARK_SCALA_VERSION%\classes;%LAUNCH_CLASSPATH%"
|
|
)
|
|
|
|
rem Figure out where java is.
|
|
set RUNNER=java
|
|
if not "x%JAVA_HOME%"=="x" set RUNNER=%JAVA_HOME%\bin\java
|
|
|
|
rem The launcher library prints the command to be executed in a single line suitable for being
|
|
rem executed by the batch interpreter. So read all the output of the launcher into a variable.
|
|
set LAUNCHER_OUTPUT=%temp%\spark-class-launcher-output-%RANDOM%.txt
|
|
"%RUNNER%" -cp "%LAUNCH_CLASSPATH%" org.apache.spark.launcher.Main %* > %LAUNCHER_OUTPUT%
|
|
for /f "tokens=*" %%i in (%LAUNCHER_OUTPUT%) do (
|
|
set SPARK_CMD=%%i
|
|
)
|
|
del %LAUNCHER_OUTPUT%
|
|
%SPARK_CMD%
|