Recently, I installed the Salesforce CLI and set up VS Code with the Salesforce extensions. After creating a new project, when I try to open an Apex file, I receive the error message “unable to activate the Apex language server.” Then, after going through the VS Code settings, I found out that the JDK path was not set correctly.
Here, I will explain to you how to solve the error that you faced when unable to activate the apex language server in the VS code editor.
While developing Apex code, you sometimes face this type of error, especially when you connect VS Code to the Salesforce org for the first time. This error occurs because we didn’t set the VS Code folder path to Java.

Solve Error: Unable to Activate the Apex Language Server
In the following steps, I have explained how you can completely solve the apex language server error.
- To resolve the error, we need to download and install JDK 11 or 17 according to the OS installed on your system.

- After downloading the JDK, you need to install it. When the installation is done successfully, you will see the Finish button.

- Then, you need to copy the JDK folder path where you installed it. After navigating to the installed location, copy the file path.

- Then open the VS Code editor. Click the File menu, then click the Preferences option. Under the preferences, you will see the Settings option; click on it.

- As you open the preference settings, you need to search for Apex in the search bar, and as you scroll down, you will see the Salesforce-vscode-apex option. Under that option, you will see some examples of different OS.
- Below those examples, you will see a text box where you need to paste the copied JDK folder path. Upon entering the path, you can view examples of the path format and must enter the path accordingly.
- After entering the path, wait for 2 minutes and then restart the VS Code application; you will see that the ‘unable to activate the Apex language server‘ error is resolved.