Java examples for Big Data:Hadoop
apache hadoop hbase HTable Descriptor
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.client.HBaseAdmin; public class ListTables { public static void main(String args[]) throws MasterNotRunningException, IOException { // Instantiating a configuration class Configuration conf = HBaseConfiguration.create(); // Instantiating HBaseAdmin class HBaseAdmin admin = new HBaseAdmin(conf); // Getting all the list of tables using HBaseAdmin object HTableDescriptor[] tableDescriptor = admin.listTables(); // printing all the table names. for (int i = 0; i < tableDescriptor.length; i++) { System.out.println(tableDescriptor[i].getNameAsString()); }/*from w w w. j a va2 s .c o m*/ } }