I just downloaded the GlassFish 5.0 archive - Full Platform, unzipped it, I run it through the command line.
asadmin start-domain
pr
OK, Glassfish 5.1 doesn't exist for the moment. Continue with Glassfish 5.0 with this solution:
Just set the AS_JAVA variable in your asenv.bat file located here: C:\DEVENV\glassfish5\glassfish\config.
AS_JAVA
asenv.bat
C:\DEVENV\glassfish5\glassfish\config
File to edit: add last line
Relaunch your server....enjoy :