4

Working through "Build Lightning Web Components" trail on Trailhead. I completed the Quick Start project, setting up both my DX environment and configuring VS Code.

Somehow I completely overlooked the note that said "Some features, particularly Apex support, in Salesforce Extensions for Visual Studio Code depend on the Java Platform, Standard Edition Development Kit 8 (JDK8). Even if you have another version of Java installed, you need to also install JDK8. Once you install JDK8 you can follow the steps here to configure your setup."

This did not come back to haunt me until working through the 2nd module of the 2nd project in the trail, titled "Set Up Your Lightning Web Components Developer Tools" , specifically in the "Create a Lightning Web Component" module. When attempting to create my first scratch org, I started getting errors in VS Code "Java runtime could not be located. Set one using the salesforcedx-vscode-apex.java.home VS Code setting."

While I was able to manually resolve my issues (thanks Google) I wanted to verify that I did not miss a trail/project/module on installation/configuration of JRE8.

Also, the timing on these 2 project is way off. The advertised time for "Set Up Your Lightning Web Components Developer Tools" was 30 mins, whereas it took me close to 2 hours, due to the downloading and Googling.

7

Thank you for the feedback and sorry our content was not clearer about how to set up Java for Salesforce Extensions for Visual Studio Code.

We have some better instructions coming in new content in the March release, but I'll make sure we get the instructions centralized and referenced from other content using VS Code, like the Lightning Web Components quick start.

Until then, here's a snippet of new content coming in March release to set up Java setting in VS Code:


Install Java Standard Edition Development Kit 8

Some features, particularly Apex support, in Salesforce Extensions for Visual Studio Code depend on the Java Platform, Standard Edition Development Kit 8 (JDK8). Even if you have another version of Java installed, you need to also install JDK8.

  1. Install Java from Java SE Development Kit 8 Downloads.

  2. Confirm Java is properly installed by locating its installation directory. We need it in the next step. For example, if you installed JDK8 build 201 then these are the default installation directories.

    • Windows: C:\Program Files\Java\jdk1.8.0_201.
    • MacOS: /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home.

Configure Java Home Setting for Apex Support

By default, Salesforce Extensions for Visual Studio Code attempts to locate your Java installation directory by looking for a JAVA_HOME or JDK_HOME environment variable on your computer. You can also set the salesforcedx-vscode-apex.java.home setting to point to the Java installation directory you want to use, which is helpful when you have multiple versions installed. For this project, let’s configure Visual Studio Code settings to point to our JDK8 installation directory.

  1. In Visual Studio Code, click File > Preferences > Settings (Windows or Linux) or Code > Preferences > Settings (macOS).

  2. Enter apex java in the search box, then under the Salesforcedx-vscode-apex > Java: Home section, click Edit in settings.json. enter image description here

  3. Change the salesforcedx-vscode-apex.java.home setting to the full path to your Java installation directory identified in the previous step. Note that for Visual Studio Code settings, the backslashes must be escaped (\) but forward slashes (/) don’t. enter image description here

  4. Relaunch Visual Studio Code to ensure the setting takes effect.

0

Well, to answer your question, No, last i checked there is no trail on setting up JDK8.

Installation/configuration of JDK8 is in no way SF related in my opinion, eventhough it comes as part of the tech stack you must be aware of and use, I dont believe it is Salesforce's responsibility to provide you detailed steps on setting up your local environment. I'm glad you were able to 'google' your way into getting setup properly, there is plenty of documetnation online in regards to setting up JDK8, more specificaly, Oracle documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.