Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do I need the JavaRuntime to work with this tool? #100

Closed
abhidotnet opened this issue Sep 7, 2017 · 21 comments
Closed

Do I need the JavaRuntime to work with this tool? #100

abhidotnet opened this issue Sep 7, 2017 · 21 comments
Assignees
Labels

Comments

@abhidotnet
Copy link

Summary

Getting this message
"Java runtime could not be located. Set one using the salesforcedx-vscode-apex.java.home VS Code setting"

Steps To Reproduce:

Open visual studio code with the extension enabled

VS Code Version:
1.15.1
SFDX CLI Version:
v40.0
OS and version:
Windows 10 64 bit.

@vazexqi
Copy link
Contributor

vazexqi commented Sep 7, 2017

Yes, you do. Specifically Java 8. I just noticed that we don't call this out specifically in the README. We should mention that.

I'll mention describe the reason: The code smartness in Apex is powered by our new Apex compiler which is written in Java. Hence, you need Java to be able to run this.

@abhidotnet
Copy link
Author

Thanks for the reply. Where and how should I set this up?

@salesforce1development
Copy link

@abhidotnet - Please check my video on youtube.. how to setup vscode for auto completion. It covers step to setup java.

@vazexqi - I do not want to promote my video here .. please feel free to delete my comment if it is not appropriate... I just want to help people and want maximum people to use this tool. Thank you for your video.. My video was based on your's.

@vazexqi
Copy link
Contributor

vazexqi commented Sep 11, 2017

@ruthemmanuelle - Do we have any instructions for setting up Java for the VS Code extension? I assume that it would be the same as it has been for the Eclipse IDE?

Also, should this be added to the Troubleshooting guide?

@ruthemmanuelle
Copy link
Contributor

@vazexqi - Maybe we can add the info that Java is a prerequisite to the "Get Started with Salesforce Development Tools for Visual Studio Code" section here? https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode

Here's what we say about Java for Force.com IDE 2 (https://developer.salesforce.com/docs/atlas.en-us.sfdx_ide2.meta/sfdx_ide2/sfdx_ide2_get_started_prerequisites.htm):
Java 8 Platform, Standard Edition Development Kit
Force.com IDE 2 is built on the Eclipse platform. Eclipse requires 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.

Would the same info apply here, or do Salesforce Development Tools for Visual Studio Code users not need the full JDK?

Adding something to the Troubleshooting guide as well as to the doc I linked to sounds good to me.

@vazexqi
Copy link
Contributor

vazexqi commented Sep 12, 2017

@ruthemmanuelle - Let's continue to use the JDK. The JRE might be sufficient but in all our local and test environments, we are using the JDK so let's just keep it consistent that way.

  1. Yes, adding that blurb to the top-level salesforce.salesforcedx-vscode would be best.
  2. I think adding it duplicating it to the salesforce.salesforcedx-vscode-apex would also be useful since some people tend to install that extension by itself. This one I don't have a strong opinion on.
  3. And, finally, the troubleshooting guide would be useful.

@abhidotnet
Copy link
Author

How would I setup the path on windows? I have the jre for java 8 installed and the standard path
/Program Files/Java/jre1.8.0_144/bin is not working for me.

@donttrickrick
Copy link

@abhidotnet - /Program Files/Java/jre1.8.0_144. This works for me.

@vazexqi
Copy link
Contributor

vazexqi commented Sep 21, 2017

I'm closing this since this is not an issue with our extension. There are enough resources on how to install Java on a machine.

@guw
Copy link
Contributor

guw commented Sep 24, 2017

How to configure the location of the Java Runtime:

https://github.com/forcedotcom/salesforcedx-vscode/wiki/Apex-Language-Server#how-do-i-configure-the-version-of-java-that-the-apex-language-server-uses

@abhidotnet
Copy link
Author

abhidotnet commented Sep 28, 2017

I placed the following entry in my user settings file.
"salesforcedx-vscode-apex.java.home": "C:\\Program Files\\Java\\jdk-9",
I am on windows 10 64 bit with jdk-9 installed. I am still getting that error message.

@guw
Copy link
Contributor

guw commented Sep 28, 2017

@abhidotnet Does it work for you? Please not that Java 9 is not tested at this time and may not work. You should use Java 8. See #139.

@daveb-501commons
Copy link

daveb-501commons commented Nov 9, 2017

OS: Windows 10

I was using VS Code for a couple of weeks without the java error message then after an update of the Salesforce DX Extension in VS Code started getting the java error message. I fixed the problem when I added the following to User Settings in VS Code.

"salesforcedx-vscode-apex.java.home": "C:\Program Files\Java\jre1.8.0_151",

@okram999
Copy link

Seriously, just follow the basics. Have the JAVA_HOME env in your pc/mac !

@guify
Copy link

guify commented Jan 8, 2018

I am running Ubuntu. My JDK is working (I got it with "apt-get install default-jdk"). I didn't have to do anything with JAVA_HOME to get it working.

I install vscode with "dpkg", point it to some java, and click the "get Java Extension Pack" as suggested by vscode.

And I get "Error: Java runtime could not be located."
Which is just so mysterious because I don't have any trouble locating it myself.

max% java -version
java version "1.7.0_151"
OpenJDK Runtime Environment (IcedTea 2.6.11) (7u151-2.6.11-0ubuntu1.14.04.1)
OpenJDK 64-Bit Server VM (build 24.151-b01, mixed mode)
max% code -version
1.19.1
0759f77bb8d86658bc935a10a64f6182c5a1eeba
x64
max% uname -a
Linux max 4.4.0-89-generic #112~14.04.1-Ubuntu SMP Tue Aug 1 22:08:32 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
max%

@okram999
Copy link

okram999 commented Jan 8, 2018 via email

@torynet
Copy link

torynet commented Apr 12, 2018

I feel like I have tried everything and I'm still at a loss. Am I just being stupid?
vscnolikemyjava

@vazexqi
Copy link
Contributor

vazexqi commented Apr 12, 2018

@torynet - Your JDK_HOME is set wrongly. If you set both JAVA_HOME and JDK_HOME, we first try to read the entry of JDK_HOME and no longer try JAVA_HOME. See https://github.com/forcedotcom/salesforcedx-vscode/blob/develop/packages/salesforcedx-vscode-apex/src/requirements.ts#L46

Here is what mine looks like:

screen shot 2018-04-12 at 3 39 06 pm

Of course, yours would need to change yours to match your installation.

Let me know if that still doesn't work.

@torynet
Copy link

torynet commented Apr 13, 2018

@vazexqi - First of all, thanks for the help. This seems so simple and yet I continue to struggle. When I looked up settings for these environment variables, I read that a good practice was to set one and then just refer to it from the others, but even when they are all set directly, nothing changes for me.
vscnolikemyjava

@torynet
Copy link

torynet commented Apr 13, 2018

Actually, isn't the VSC user setting supposed to override all of that anyway?

@torynet
Copy link

torynet commented Apr 13, 2018

And therein lies the problem. Got it. I swear I had tried that set to the base directory and not bin previously, but it seems to solve the problem, so I guess not. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants