Unable to Activate the Apex Language Server

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.

Unable to Activate the Apex Language Server

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.

  1. To resolve the error, we need to download and install JDK 11 or 17 according to the OS installed on your system.
Solve Error: Unable to Activate the Apex Language Server
  1. After downloading the JDK, you need to install it. When the installation is done successfully, you will see the Finish button.
Solve Error Unable to Activate the Apex Language Server
  1. Then, you need to copy the JDK folder path where you installed it. After navigating to the installed location, copy the file path.
Set JDK for Apex Language Error
  1. 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.
Setup JDK for Apex in VS code
  1. 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.
Salesforce Apex Language Server Error

In this way, you can resolve the Apex language server error.

Conclusion

I hope you now have an idea of being unable to activate the Apex language server error. I have explained when this type of error occurs and how to resolve the Apex language server error that we face in the VS Code editor.

You may like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.