Submit Hadoop Jar through Java program

hadoop, java

Solution

Yes, you can use ProcessBuilder or Runtime.exec to execute arbitrary system commands

EDIT: The solution I proposed is to just launch the hadoop command as you have specified. Hadoop does have an API for launching jobs, discussed in Calling a mapreduce job from a simple java program.

Problem

I am new to Hadoop. Our team is writing a hadoop job scheduler. Currently I have hadoop well installed. I can submit Hadoop job in the command line using ``` hadoop jar wordcount.jar input output ``` Now I want to run this command in a java program. In other words, using java to do the same thing as `hadoop jar wordcount.jar input output`. Is there any API I can call to submit jobs from Java?

Original source

Related problems