This is probably because of a lack of configuration. Try to add the Hadoop configuration files as a resource to the object Configuration:
Configuration conf = new Configuration();
FileSystem hdfs = FileSystem.get(conf);
I hope this will help. If you get any other queries regarding this, please post it here.