# Enabling grammar engine

The grammar engine [requires](/v6.12.0/deployment/installation-requirements/software-requirements.md) Java **17 or higher**.

If `PathToJavaVirtualMachine` is empty, AppServer tries to auto-detect the JVM.

If needed, set the JVM path manually in `AppServerX.xml`.

You can also configure the grammar engine during installation:

* [Install on Windows with IIS](/v6.12.0/deployment/installation/windows/install-on-windows-with-iis.md)
* [Install on Linux with NGINX](/v6.12.0/deployment/installation/linux/install-on-linux-with-nginx.md)
* [Automated install on Linux](/v6.12.0/deployment/installation/linux/automated-installation-on-linux.md) (path\_to\_jvm)

{% stepper %}
{% step %}

#### Install Java 17+

Install **JRE 17+** or **JDK 17+** on the same server.

The grammar engine runs inside a Java Virtual Machine (JVM).
{% endstep %}

{% step %}

#### Update AppServerX.xml

Locate `AppServerX.xml` in your WebSpellChecker installation directory:

`<WebSpellChecker_Installation_Path>/AppServer/AppServerX.xml`

Find these tags:

* [`PathToJavaVirtualMachine`](/v6.12.0/deployment/configuration/application-server/appserver-parameters.md#draft-appserverparameters-pathtojavavirtualmachine)
* `JVMMaxMemorySizeMb` (see [Configure JVM maximum heap size](/v6.12.0/deployment/configuration/grammar-check-engine-setup/configure-jvm-maximum-heap-size.md))

Update the values as needed:

```xml
<!-- Java 17 or higher is required to use LanguageTool grammar engine. In case of empty tag AppServer tries to detect path to JVM library automatically. -->
<!-- You can put your path to JVM library here. Path example for Linux: '/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so'. -->
<!-- Path example for Windows: 'C:/Program Files/Java/jdk-17/bin/server/jvm.dll' -->
<PathToJavaVirtualMachine></PathToJavaVirtualMachine>
<!-- Put maximum heap size restriction in megabytes for LanguageTool in Java Virtual Machine. -->
<JVMMaxMemorySizeMb>2048</JVMMaxMemorySizeMb>
```

{% endstep %}

{% step %}

#### Restart AppServer

Restart AppServer to apply changes in `AppServerX.xml`.

To restart: [stop](https://docs.wproofreader.com/v6.12.0/deployment/configuration/grammar-check-engine-setup/pages/IA2KNQLXDh85TwDivL4y#mainappservercommands-stopappserverwindowslinux2.stopappserver) the application, then [start](https://docs.wproofreader.com/v6.12.0/deployment/configuration/grammar-check-engine-setup/pages/IA2KNQLXDh85TwDivL4y#mainappservercommands-startappserverwindowslinux1.startappserver) it again.

Use [Main AppServer commands](/v6.12.0/deployment/configuration/application-server/main-appserver-commands.md).
{% endstep %}

{% step %}

#### Verify operability

The status should show **"active": true** for the grammar engine.

1. Check the [status](/v6.12.0/api-reference/auxiliary-api-commands/status-api.md):

```json
{
    "SpellCheckEngine": {
        "active": true
    },
    "GrammarCheckEngine": {
        "active": true
    },
    "EnglishAIModel": {
        "active": true
    },
    "GermanAIModel": {
        "active": true
    },
    "SpanishAIModel": {
        "active": true
    },
    "EnglishAutocomplete": {
        "active": true,
    }
}
```

2. Open the demo sample pages:

`http(s)://<your_host_name>:<port>/<virtual_directory>/samples`

3. Check `AppServer/Logs` (for example, `Child-0.log`, `Child-1.log`).

You’ll see this error if AppServer can’t load the JVM:

```
MM/DD/YY:HH:MM:50.821	#18794:0	Subsystem_General	Error	Failed to load Java Virtual Machine (JVM). At least Java 17 is required to use the algorithmic grammar engine. You can specify a path to JVM in AppServerX.xml in the PathToJavaVirtualMachine tag.
```

{% endstep %}
{% endstepper %}

### Related topics

* [AppServer parameters](/v6.12.0/deployment/configuration/application-server/appserver-parameters.md)
* [Configure JVM maximum heap size](/v6.12.0/deployment/configuration/grammar-check-engine-setup/configure-jvm-maximum-heap-size.md)
* [Install on Windows with IIS](/v6.12.0/deployment/installation/windows/install-on-windows-with-iis.md)
* [Install on Linux with NGINX](/v6.12.0/deployment/installation/linux/install-on-linux-with-nginx.md)
* [Automated install on Linux](/v6.12.0/deployment/installation/linux/automated-installation-on-linux.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wproofreader.com/v6.12.0/deployment/configuration/grammar-check-engine-setup/enabling-grammar-engine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
