Set the JDK Path in GlassFish

GlassFish version: 5.1.0
Windows version: 10


You may have several version of the JDK installed on your machine. By default you may be using JDK 11 or even 13, but GlassFish requires JDK 8.


Running asadmin generates the following error

Exception in thread “main” java.lang.NullPointerException
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.initializeServiceLocator(
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newServiceLocator(
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(
at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(
at com.sun.enterprise.module.single.StaticModulesRegistry.createServiceLocator(
at com.sun.enterprise.admin.cli.CLIContainer.getServiceLocator(
at com.sun.enterprise.admin.cli.CLIContainer.getLocalCommand(
at com.sun.enterprise.admin.cli.CLICommand.getCommand(
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(
at com.sun.enterprise.admin.cli.AdminMain.doMain(
at org.glassfish.admin.cli.AsadminMain.main(


Edit: ~\glassfish\config\asenv.bat
Assuming JDK 8 installation path is C:\Program Files\Java\jdk1.8.0_241

Add the line:

set AS_JAVA=C:\Program Files\Java\jdk1.8.0_241

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s