Not sure if this is what you're looking for, but have you looked at java's ProcessBuilder? You can do something like
for (line <- lines) { val command = line.split(" ") // You may need to deal with quoted strings val process = new ProcessBuilder(command) // redirect output of process to main thread process.start() } Or are you trying to launch an interactive REPL in the middle of your application? 2014-06-11 22:56 GMT-07:00 JaeBoo Jung <itsjb.j...@samsung.com>: > Hi all, > > > > Can I use spark-shell programmatically in my spark application(in java or > scala)? > > Because I want to convert scala lines to string array and run > automatically in my application. > > For example, > > for( var line <- lines){ > > //run this line in spark shell style and get outputs. > > run(line); > > } > > Thanks > > _____________________________________________ > > *JaeBoo, Jung* > Assistant Engineer / BDA Lab / Samsung SDS >