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

Allow custom java path #40

Closed
multimeric opened this issue Nov 1, 2024 · 3 comments
Closed

Allow custom java path #40

multimeric opened this issue Nov 1, 2024 · 3 comments

Comments

@multimeric
Copy link

On our HPC the extension crashes with the following error. Full trace is below.

Error: LinkageError occurred while loading main class nextflow.lsp.NextflowLanguageServer
	java.lang.UnsupportedClassVersionError: nextflow/lsp/NextflowLanguageServer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

I had a look through the extension settings, but there isn't anything for specifying the Java path for the extension. HPC systems such as ours often have old system libraries but newer versions in modules, so it would be great to be able to vscode where to find a newer JDK.

This probably relates to but isn't the same as #35.

System Details:

Version: 1.93.1 (Universal)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z (1 mo ago)
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.5.0

Full traceback:

Error: LinkageError occurred while loading main class nextflow.lsp.NextflowLanguageServer
	java.lang.UnsupportedClassVersionError: nextflow/lsp/NextflowLanguageServer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
[Error - 5:22:37 pm] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 5:22:37 pm] Connection to server got closed. Server will restart.
true
[Error - 5:22:37 pm] Nextflow Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Error: LinkageError occurred while loading main class nextflow.lsp.NextflowLanguageServer
	java.lang.UnsupportedClassVersionError: nextflow/lsp/NextflowLanguageServer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
[Error - 5:22:37 pm] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 5:22:37 pm] Connection to server got closed. Server will restart.
true
[Error - 5:22:37 pm] Nextflow Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Error: LinkageError occurred while loading main class nextflow.lsp.NextflowLanguageServer
	java.lang.UnsupportedClassVersionError: nextflow/lsp/NextflowLanguageServer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
[Error - 5:22:37 pm] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 5:22:37 pm] Connection to server got closed. Server will restart.
true
[Error - 5:22:37 pm] Nextflow Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 5:22:37 pm] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Error: LinkageError occurred while loading main class nextflow.lsp.NextflowLanguageServer
	java.lang.UnsupportedClassVersionError: nextflow/lsp/NextflowLanguageServer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
[Error - 5:22:37 pm] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 5:22:37 pm] Connection to server got closed. Server will restart.
true
[Error - 5:22:37 pm] Nextflow Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 5:22:37 pm] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Error: LinkageError occurred while loading main class nextflow.lsp.NextflowLanguageServer
	java.lang.UnsupportedClassVersionError: nextflow/lsp/NextflowLanguageServer has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
[Error - 5:22:38 pm] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 5:22:38 pm] The Nextflow Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 5:22:38 pm] Nextflow Language Server client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 5:22:38 pm] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
@bentsherman
Copy link
Member

Which version of Java do you have? 17 or newer should work, although I am seeing cases where it crashes even with 17

There is a setting called "Nextflow > Java > Home" which allows you to set the equivalent of JAVA_HOME, can you try that?

@multimeric
Copy link
Author

Which version of Java do you have? 17 or newer should work, although I am seeing cases where it crashes even with 17

As I said, the system version is very old:

 java --version
openjdk 11.0.24 2024-07-16 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.24.0.8-2) (build 11.0.24+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.24.0.8-2) (build 11.0.24+8-LTS, mixed mode, sharing)

There is a setting called "Nextflow > Java > Home" which allows you to set the equivalent of JAVA_HOME, can you try that?

Sorry, you're totally right, I somehow missed this! Once I set it in the settings, everything started working:

{
    "nextflow.java.home": "/path/to/openjdk/22.0.2"
}

@jeskowagner
Copy link

Noting this in case others stumble across it: in case you use nextflow and java from a conda environment, set nextflow.java.home (as in Michael's answer above) to the base of your conda environment, which you can get with echo $CONDA_PREFIX. If you still have trouble, make sure to update your java version with conda install openjdk>17.

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

No branches or pull requests

3 participants