Main Content

addJar

Class: matlab.compiler.mlspark.SparkContext
Package: matlab.compiler.mlspark

Add JAR file dependency for all tasks that need to be executed in a SparkContext

Syntax

addJar(sc,filePath)

Description

addJar(sc,filePath) adds a JAR file from a location specified by filePath to all tasks that need to be executed in SparkContext sc.

Input Arguments

expand all

The SparkContext to use, specified as a SparkContext object.

Location of JAR file, specified as a character vector enclosed in ''.

Data Types: char | string

Examples

expand all

Add a JAR file dependency for all tasks that need to be executed in a SparkContext.

%% Connect to Spark
sparkProp = containers.Map({'spark.executor.cores'}, {'1'});
conf = matlab.compiler.mlspark.SparkConf('AppName','myApp', ...
                        'Master','local[1]','SparkProperties',sparkProp);
sc = matlab.compiler.mlspark.SparkContext(conf);
%% Add JAR file
sc.addJar('/share/myArchive.jar')
Introduced in R2016b