0

Is it possible to check spark installation or spark version through Java Code?

Please provide any suggestions.

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
Kumaresh Babu N S
  • 1,648
  • 5
  • 23
  • 39
  • To check for an API, [checking whether a package is existent or not](http://stackoverflow.com/q/2547867/4391450) – AxelH May 19 '17 at 05:53

2 Answers2

0

I'm not sure but this might work:classOf[SparkContext].getPackage.getImplementationVersion for more information check out programmatic-way-to-tell-Spark-version

Hope it helps

ajansson
  • 1
  • 4
0

TL;DR It'd be a very tough programming assignment if possible at all.

You'd have to implement find-like Java application to search for files like jars/spark-core_*-*.jar and even that would not be an exhaustive search as one could install Spark with a complete rename of everything Spark comes with.

You could also search for some environment variables like SPARK_HOME, but since that's not required to use Spark effectively either, I would not count on that.

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420