I have been getting this error for a long now when trying to install hadoop on ubuntu..
:~/hadoop$ bin/hdfs namenode -format
Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I tried to format the namenode using the command but rather got this error as unrecognized command