+ Start a Discussion
Josip Juric87Josip Juric87 

VS Code with SFDX - ERROR: Java 8 is required to run

After installing VS Code and adding the Salesforce extensions, I get the error: "Java 8 is required to run. Download and install it from https://java.com/en/download/.", although I have Java 9 running. What can I do to fix that?
NagendraNagendra (Salesforce Developers) 
Hi Josip,

Sorry for this issue you are encountering.

May I suggest you please check with the prerequisites below.
Prerequisites
  • Before you set up this extension, make sure that you have these essentials.
  • Java 8 Platform, Standard Edition Development Kit
  • Some features in Salesforce Extensions for VS Code depend upon the Java 8 Platform, Standard Edition Development Kit (JDK).
  • If you don’t already have the JDK installed, install the latest version of the Java 8 JDK from Java SE Development Kit 8 Downloads.
  • Visual Studio Code v1.17 or later
  • Salesforce Extensions for VS Code
  • Code smartness for sObjects in Apex code is powered by the salesforcedx-vscode-core extension. We suggest that you install all extensions in the salesforcedx-vscode extension pack.
  • Its a must that you need to have Java8 platform for this
For more information please check with below link which might help you further. Please let us know if this helps.

Thanks,
Nagendra
Andrea CrucianiAndrea Cruciani
I'm facing the same issue: Java 9 is required for the most recent security requirements in most business workplaces/workstations so the requirement to downgrade to java 8 platform is not acceptable for many developers. Plugin must be updated to work with java 9 platform
 
Ken PennKen Penn
The above link is a 404, does not help. When will more recent versions of Java be enabled?
JPSeaburyJPSeabury
I'm using Java 11, and have not run into any issues although I've only set up my environment this week, and have only done some basic things: create projects, authorize a dev hub on a pre-release Spring'19 instance of SF, create lightning web components, etc. I haven't run into any errors indicating I need to regress back to Java 8.
JPSeaburyJPSeabury
I spoke too soon. Ran into my first issue this AM (using the Create Project with Manifest) command in which VS Code returned an error indicating Java 8 was required to run (I'm running Java 11).  Ugh.

User-added image
Ken Penn 9Ken Penn 9
To use multiple versions of Java on a mac:
1) Download and install Java version 8 from https://java.com/en/download/mac_download.jsp.
2) In the OS terminal, enter command /usr/libexec/java_home -verbose 
3) In the output, take note of the version number for Java 8, e.g. 1.8.0_191
4) In the OS terminal, enter command 
    export JAVA_HOME=`/usr/libexec/java_home -v <version>`
    e.g. export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_191`

To use the other version of Java, repeat steps 2 to 4 with that version.
Jason J AugerJason J Auger
I was also experiencing this issue and have just managed to fix it.  Hopefully this works for you also.
  • Remove all installed versions of the JDK/JRE from your machine (recommend restart afterwards).  Make sure that when typing "/usr/libexec/java_home -verbose" in the terminal, it shows you have 0 (zero) virtual machines installed.  It was showing I had version 10 initially.
  • Download/install the latest JDK (which comes with the JRE).
  • Running "/usr/libexec/java_home -verbose" now shows the following for me:User-added image
  • If you have changed any user settings for your Java path in VS Code, remove and restart VS Code.
Fernando Gonzalez 24Fernando Gonzalez 24
https://developer.salesforce.com/forums/ForumsMain?id=9062I000000g8F3QAI#!/feedtype=SINGLE_QUESTION_SEARCH_RESULT&id=9062I000000g8F3QAI
Sandeep LohaniSandeep Lohani

Well, this is my first post and the following link worked for me to resolve the JAVA required to issue(even though I had java 8 installed).

https://forcedotcom.github.io/salesforcedx-vscode/articles/getting-started/java-setup

 

AdoptOpenJDK
AdoptOpenJDK provides prebuilt OpenJDK binaries for free without authentication or complications.
Navigate to AdoptOpenJDK
Select OpenJDK 11 (LTS)
Select HotSpot
Click the Latest Release button to download.
Once the file is downloaded open it and complete the installation steps.