redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 439 forks source link

The "path" argument must be of type string. Received type object. #1489

Open aeschli opened 4 years ago

aeschli commented 4 years ago

Version: 1.46.0-insider Commit: 9f89da69154ac6c99dfa7c82986e2df95b7bbe0b Date: 2020-06-08T22:13:15.761Z Electron: 7.3.1 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Linux x64 5.3.0-55-generic

Starting up the Java extension I get the following error:

[2020-06-09 10:13:00.576] [exthost] [error] Activating extension redhat.java failed due to an error:
[2020-06-09 10:13:00.576] [exthost] [error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type object
    at validateString (internal/validators.js:112:11)
    at Object.join (path.js:1040:7)
    at /home/martin/.vscode-insiders/extensions/redhat.java-0.62.0/dist/extension.js:7:11895
    at new Promise (<anonymous>)
    at /home/martin/.vscode-insiders/extensions/redhat.java-0.62.0/dist/extension.js:7:11865
    at Object.<anonymous> (/home/martin/.vscode-insiders/extensions/redhat.java-0.62.0/dist/extension.js:7:12607)
    at Generator.next (<anonymous>)
    at o (/home/martin/.vscode-insiders/extensions/redhat.java-0.62.0/dist/extension.js:7:10014)

Same as #1449, but different stack trace.

Checking my env, JAVA_HOME is not set

fbricon commented 4 years ago

@aeschli can you try debugging the vscode-java extension to see what's happening?

aeschli commented 4 years ago

Sorry, I don't have the Java setup ready. After I installed the latest Oractle JDK (11) and I added the JAVA_HOME variable set the error went away.

Ghack9 commented 4 years ago

Sorry, I don't have the Java setup ready. After I installed the latest Oractle JDK (11) and I added the JAVA_HOME variable set the error went away.

Can You Please Add Whole Code Where to Write 'JAVA_HOME'

tails618 commented 4 years ago

@aeschli sorry to bring back an old thread, but I have a question. Is the JAVA_HOME variable a PATH variable? If so, what is the directory?

testforstephen commented 4 years ago

@Ghack9 @tails618 A simple way is to configure it in the VS Code User Settings. You could open User Settings via shortcut below, then search java.home and set your JDK installation directory to the java.home setting.

Hagar-Usama commented 3 years ago

Sorry, I don't have the Java setup ready. After I installed the latest Oractle JDK (11) and I added the JAVA_HOME variable set the error went away.

Can You Please Add Whole Code Where to Write 'JAVA_HOME'

As @testforstephen said java_path

How to get the Java_HOME

echo $(readlink -f /usr/bin/java | sed "s:bin/java::")