Major problem with running sqoop command from Java program is that you need to make sure that all the libraries required by sqoop are on the class path. If libraries are missing it would result in ClassNotFoundException. Sqoop requires hadoop libraries, hbase libraries if you are performing hbase import and hive libraries if you are creating tables in hive. It also uses libraries from SQOOP_HOME/lib folder.
It is very tricky to get the sqoop import working by directly calling the sqoop API's. Because you are bypassing the sqoop.sh command, which sets the environment (like adding required libraries to class-path etc.) before calling the sqoop API's.
What I would suggest you is to try using ProcessBuilder.exec()
to run sqoop import from java program.