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

"Java runtime could not be located" for Windows + Oracle JDK #836

Closed
Eskibear opened this issue Mar 13, 2019 · 4 comments · Fixed by #1010
Closed

"Java runtime could not be located" for Windows + Oracle JDK #836

Eskibear opened this issue Mar 13, 2019 · 4 comments · Fixed by #1010

Comments

@Eskibear
Copy link
Contributor

For Windows, if JDK installer is downloaded here from Oracle, the java executable is special, JAVA_HOME is not set either. I don't understand why Oracle did such a tricky thing.

Setting java.home to "C:\Program Files\Java\jdk1.8.0_201" do help me out. But the user experience is terribly bad, especially for new Java developers. Can we find a way to optimize for Windows+OracleJDK users? (i.e. recognize Java home automatically for them)

image

C:\Users\username>where java
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe

C:\Users\username>java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
Environment
  • Operating System: Windows 10
  • JDK version: Oracle JDK 8u201
  • Visual Studio Code version: 1.32.1
  • Java extension version: 0.40.0
@fbricon
Copy link
Collaborator

fbricon commented Mar 13, 2019

Isn't javapath pointing at a JRE? We need a JDK

@Eskibear
Copy link
Contributor Author

Eskibear commented Mar 13, 2019

Yes, you are right. Just tried printing the java.home and it's "C:\Program Files\Java\jre1.8.0_201". I never knew that before.

Yet I have to say the experience is not friendly enough to new comers. When I saw the message "Java runtime could not be located", I was thinking "fool me? I do have a java runtime and I can execute java program in CLI". I'm wondering whether there is any possibility to infer the JDK home? Or maybe at least the error message should be more concrete, e.g. something like "JDK is required but can be located." Just my two cents.

@fbricon
Copy link
Collaborator

fbricon commented Mar 14, 2019

Updated message:
Screen Shot 2019-03-14 at 4 54 22 PM

@Eskibear
Copy link
Contributor Author

I was always wondering why the library find-java-home could not recognize a newly installed Oracle JDK, until I step into the code. With some simple testing, I find several issues: jsdevel/node-find-java-home#19

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

Successfully merging a pull request may close this issue.

2 participants