Recently one of my students was getting this error – I thought I would put it here in case anyone else could be benefited:
On clicking uiautomatorviewerbat file, i am getting this error in cmd
-Djava.ext.dirs=..\lib\x86_64;..\lib is not supported. Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Press any key to continue . . .
This issue is caused by incompatible Java version. If you are getting this issue, please uninstall JDK 9 and install JDK 8. This will fix your issue.