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

Could not run ltex-ls with Java, please see the output panel 'LTeX Language Client' for details. #782

Open
k2pctdn opened this issue Dec 30, 2022 · 4 comments
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label)

Comments

@k2pctdn
Copy link

k2pctdn commented Dec 30, 2022

Describe the bug
Every time I open VS Code on macOS the LTEX error "Could not run ltex-ls with Java, please see the output panel 'LTeX Language Client' for details. You might want to try offline installation." appears.

Steps to reproduce
Steps to reproduce the behavior:

  1. Just open VS Code with LTeX installed (Marketplace version) and the above error appears.
  2. Clicking retry does not help.

LTeX configuration
Please paste all configuration settings starting with ltex. from your settings.json. You can help us by temporarily removing some irrelevant settings from your settings.json and see if the bug still occurs.

// Enable LanguageTool rules that are marked as picky and that are disabled by default, e.g., rules about passive voice, sentence length, etc., at the cost of more false positives.
	"ltex.additionalRules.enablePickyRules": false,

	// Optional path to a directory with rules of a language model with *n*-gram occurrence counts. Set this setting to the parent directory that contains subdirectories for languages (e.g., `en`).
	"ltex.additionalRules.languageModel": "",

	// Optional mother tongue of the user (e.g., `"de-DE"`). [More info...](https://valentjn.github.io/ltex/settings.html#ltexadditionalrulesmothertongue)
	//  - : No mother tongue
	//  - ar: Arabic
	//  - ast-ES: Asturian
	//  - be-BY: Belarusian
	//  - br-FR: Breton
	//  - ca-ES: Catalan
	//  - ca-ES-valencia: Catalan (Valencian)
	//  - da-DK: Danish
	//  - de: German
	//  - de-AT: German (Austria)
	//  - de-CH: German (Swiss)
	//  - de-DE: German (Germany)
	//  - de-DE-x-simple-language: Simple German
	//  - el-GR: Greek
	//  - en: English
	//  - en-AU: English (Australian)
	//  - en-CA: English (Canadian)
	//  - en-GB: English (GB)
	//  - en-NZ: English (New Zealand)
	//  - en-US: English (US)
	//  - en-ZA: English (South African)
	//  - eo: Esperanto
	//  - es: Spanish
	//  - es-AR: Spanish (voseo)
	//  - fa: Persian
	//  - fr: French
	//  - ga-IE: Irish
	//  - gl-ES: Galician
	//  - it: Italian
	//  - ja-JP: Japanese
	//  - km-KH: Khmer
	//  - nl: Dutch
	//  - nl-BE: Dutch (Belgium)
	//  - pl-PL: Polish
	//  - pt: Portuguese
	//  - pt-AO: Portuguese (Angola preAO)
	//  - pt-BR: Portuguese (Brazil)
	//  - pt-MZ: Portuguese (Moçambique preAO)
	//  - pt-PT: Portuguese (Portugal)
	//  - ro-RO: Romanian
	//  - ru-RU: Russian
	//  - sk-SK: Slovak
	//  - sl-SI: Slovenian
	//  - sv: Swedish
	//  - ta-IN: Tamil
	//  - tl-PH: Tagalog
	//  - uk-UA: Ukrainian
	//  - zh-CN: Chinese
	"ltex.additionalRules.motherTongue": "",

	// Optional path to a directory with rules of a pretrained neural network model.
	"ltex.additionalRules.neuralNetworkModel": "",

	// Optional path to a directory with rules of a word2vec language model.
	"ltex.additionalRules.word2VecModel": "",

	// List of BibTeX fields whose values are to be checked in BibTeX files. [More info...](https://valentjn.github.io/ltex/settings.html#ltexbibtexfields)
	"ltex.bibtex.fields": {},

	// Controls when documents should be checked. [More info...](https://valentjn.github.io/ltex/settings.html#ltexcheckfrequency)
	//  - edit: Documents are checked when they are opened or edited (on every keystroke), or when the settings change.
	//  - save: Documents are checked when they are opened or saved, or when the settings change.
	//  - manual: Documents are not checked automatically, except when the settings change. Use commands such as [`LTeX: Check Current Document`](https://valentjn.github.io/ltex/vscode-ltex/commands.html#ltex-check-current-document) to manually trigger checks.
	"ltex.checkFrequency": "edit",

	// If set to `true`, diagnostics of a file are cleared when the file is closed.
	"ltex.clearDiagnosticsWhenClosingFile": true,

	// Whether completion is enabled (also known as auto-completion, suggestions, or IntelliSense). [More info...](https://valentjn.github.io/ltex/settings.html#ltexcompletionenabled)
	"ltex.completionEnabled": false,

	// Controls which `settings.json` or external setting file ([see documentation](https://valentjn.github.io/ltex/vscode-ltex/setting-scopes-files.html#external-setting-files)) to update when using one of the quick fixes.
	"ltex.configurationTarget": {
		"dictionary": "workspaceFolderExternalFile",
		"disabledRules": "workspaceFolderExternalFile",
		"hiddenFalsePositives": "workspaceFolderExternalFile"
	},

	// Severity of the diagnostics corresponding to the grammar and spelling errors. [More info...](https://valentjn.github.io/ltex/settings.html#ltexdiagnosticseverity)
	"ltex.diagnosticSeverity": "information",

	// Lists of additional words that should not be counted as spelling errors. [More info...](https://valentjn.github.io/ltex/settings.html#ltexdictionary)
	"ltex.dictionary": {},

	// Lists of rules that should be disabled (if enabled by default by LanguageTool). [More info...](https://valentjn.github.io/ltex/settings.html#ltexdisabledrules)
	"ltex.disabledRules": {},

	// Controls whether the extension is enabled. Allows disabling LanguageTool on specific workspaces or for specific code language modes (i.e., file types). [More info...](https://valentjn.github.io/ltex/settings.html#ltexenabled)
	"ltex.enabled": [
		"bibtex",
		"context",
		"context.tex",
		"html",
		"latex",
		"markdown",
		"org",
		"restructuredtext",
		"rsweave"
	],

	// Lists of rules that should be enabled (if disabled by default by LanguageTool). [More info...](https://valentjn.github.io/ltex/settings.html#ltexenabledrules)
	"ltex.enabledRules": {},

	// Lists of false-positive diagnostics to hide (by hiding all diagnostics of a specific rule within a specific sentence). [More info...](https://valentjn.github.io/ltex/settings.html#ltexhiddenfalsepositives)
	"ltex.hiddenFalsePositives": {},

	// Initial size of the Java heap memory in megabytes (corresponds to Java's `-Xms` option, must be a positive integer). [More info...](https://valentjn.github.io/ltex/settings.html#ltexjavainitialheapsize)
	"ltex.java.initialHeapSize": 64,

	// Maximum size of the Java heap memory in megabytes (corresponds to Java's `-Xmx` option, must be a positive integer). [More info...](https://valentjn.github.io/ltex/settings.html#ltexjavamaximumheapsize)
	"ltex.java.maximumHeapSize": 512,

	// If set to an empty string, LTeX uses a Java distribution that is bundled with ltex-ls. You can point this setting to an existing Java installation on your computer to use that installation instead. [More info...](https://valentjn.github.io/ltex/settings.html#ltexjavapath)
	"ltex.java.path": "",

	// The language (e.g., `"en-US"`) LanguageTool should check against. Use a specific variant like `"en-US"` or `"de-DE"` instead of the generic language code like `"en"` or `"de"` to obtain spelling corrections (in addition to grammar corrections). [More info...](https://valentjn.github.io/ltex/settings.html#ltexlanguage)
	//  - auto: Automatic language detection (not recommended)
	//  - ar: Arabic
	//  - ast-ES: Asturian
	//  - be-BY: Belarusian
	//  - br-FR: Breton
	//  - ca-ES: Catalan
	//  - ca-ES-valencia: Catalan (Valencian)
	//  - da-DK: Danish
	//  - de: German
	//  - de-AT: German (Austria)
	//  - de-CH: German (Swiss)
	//  - de-DE: German (Germany)
	//  - de-DE-x-simple-language: Simple German
	//  - el-GR: Greek
	//  - en: English
	//  - en-AU: English (Australian)
	//  - en-CA: English (Canadian)
	//  - en-GB: English (GB)
	//  - en-NZ: English (New Zealand)
	//  - en-US: English (US)
	//  - en-ZA: English (South African)
	//  - eo: Esperanto
	//  - es: Spanish
	//  - es-AR: Spanish (voseo)
	//  - fa: Persian
	//  - fr: French
	//  - ga-IE: Irish
	//  - gl-ES: Galician
	//  - it: Italian
	//  - ja-JP: Japanese
	//  - km-KH: Khmer
	//  - nl: Dutch
	//  - nl-BE: Dutch (Belgium)
	//  - pl-PL: Polish
	//  - pt: Portuguese
	//  - pt-AO: Portuguese (Angola preAO)
	//  - pt-BR: Portuguese (Brazil)
	//  - pt-MZ: Portuguese (Moçambique preAO)
	//  - pt-PT: Portuguese (Portugal)
	//  - ro-RO: Romanian
	//  - ru-RU: Russian
	//  - sk-SK: Slovak
	//  - sl-SI: Slovenian
	//  - sv: Swedish
	//  - ta-IN: Tamil
	//  - tl-PH: Tagalog
	//  - uk-UA: Ukrainian
	//  - zh-CN: Chinese
	"ltex.language": "en-US",

	// If set to a non-empty string, LTeX will not use the bundled, built-in version of LanguageTool. Instead, LTeX will connect to an external [LanguageTool HTTP server](http://wiki.languagetool.org/http-server). Set this setting to the root URI of the server, and do not append `v2/check` or similar. [More info...](https://valentjn.github.io/ltex/settings.html#ltexlanguagetoolhttpserveruri)
	"ltex.languageToolHttpServerUri": "",

	// API key for Premium API access. Only relevant if `ltex.languageToolHttpServerUri` is set.
	"ltex.languageToolOrg.apiKey": "",

	// Username/email as used to log in at languagetool.org for Premium API access. Only relevant if `ltex.languageToolHttpServerUri` is set.
	"ltex.languageToolOrg.username": "",

	// List of LaTeX commands to be handled by the LaTeX parser, listed together with empty arguments (e.g., `"\ref{}"`, `"\documentclass[]{}"`). [More info...](https://valentjn.github.io/ltex/settings.html#ltexlatexcommands)
	"ltex.latex.commands": {},

	// List of names of LaTeX environments to be handled by the LaTeX parser. [More info...](https://valentjn.github.io/ltex/settings.html#ltexlatexenvironments)
	"ltex.latex.environments": {},

	// **Deprecated:** This setting has been renamed to [`ltex.languageToolHttpServerUri`](https://valentjn.github.io/vscode-ltex/docs/settings.html#ltexlanguagetoolhttpserveruri).
	// 
	"ltex.ltex-ls.languageToolHttpServerUri": "",

	// **Deprecated:** This setting has been renamed to [`ltex.languageToolOrg.apiKey`](https://valentjn.github.io/vscode-ltex/docs/settings.html#ltexlanguagetoolorgapikey).
	// 
	"ltex.ltex-ls.languageToolOrgApiKey": "",

	// **Deprecated:** This setting has been renamed to [`ltex.languageToolOrg.username`](https://valentjn.github.io/vscode-ltex/docs/settings.html#ltexlanguagetoolorgusername).
	// 
	"ltex.ltex-ls.languageToolOrgUsername": "",

	// Logging level (verbosity) of the ltex-ls server log, which is accessible via `View` › `Output` › `LTeX Language Server`. [More info...](https://valentjn.github.io/ltex/settings.html#ltexltex-lsloglevel)
	//  - severe: Minimum verbosity. Only log severe errors.
	//  - warning: Very low verbosity. Only log severe errors and warnings.
	//  - info: Low verbosity. Additionally, log startup and shutdown messages.
	//  - config: Medium verbosity. Additionally, log configuration messages.
	//  - fine: Medium to high verbosity (default). Additionally, log when LanguageTool is called or LanguageTool has to be reinitialized due to changed settings.
	//  - finer: High verbosity. Log additional debugging information such as full texts to be checked.
	//  - finest: Maximum verbosity. Log all available debugging information.
	"ltex.ltex-ls.logLevel": "fine",

	// If set to an empty string, LTeX automatically downloads [ltex-ls from GitHub](https://github.com/valentjn/ltex-ls/releases), stores it in the folder of the extension, and uses it for the checking process. You can point this setting to an ltex-ls release you downloaded by yourself. [More info...](https://valentjn.github.io/ltex/settings.html#ltexltex-lspath)
	"ltex.ltex-ls.path": "",

	// List of Markdown node types to be handled by the Markdown parser. [More info...](https://valentjn.github.io/ltex/settings.html#ltexmarkdownnodes)
	"ltex.markdown.nodes": {},

	// Size of the LanguageTool `ResultCache` in sentences (must be a positive integer). [More info...](https://valentjn.github.io/ltex/settings.html#ltexsentencecachesize)
	"ltex.sentenceCacheSize": 2000,

	// If set to `true`, an item about the status of LTeX is shown permanently in the status bar.
	"ltex.statusBarItem": false,

	// Debug setting to log the communication between language client and server. [More info...](https://valentjn.github.io/ltex/settings.html#ltextraceserver)
	//  - off: Don't log any of the communication between language client and server.
	//  - messages: Log the type of requests and responses between language client and server.
	//  - verbose: Log the type and contents of requests and responses between language client and server.
	"ltex.trace.server": "off",

"LTeX Language Server" log file
First, reproduce the bug. Then, go to ViewOutput and select LTeX Language Server in the drop-down list. Paste this log here:

Nothing shows up in LTeX Language Server Ouput

"LTeX Language Client" log file
First, set the ltex.trace.server setting in your settings.json to "verbose". Then, reload the VS Code window and reproduce the bug. Go to ViewOutput and select LTeX Language Client in the drop-down list. Paste this log here (note: it will contain your checked document):

2022-12-30T13:41:24.988Z Info: Setting LTeX UI language to 'en-us'.
2022-12-30T13:41:24.988Z Info: Loading i18n messages...
2022-12-30T13:41:24.989Z Info: Loading default i18n messages...
2022-12-30T13:41:24.990Z Info: 
2022-12-30T13:41:24.990Z Info: ltex.ltex-ls.path not set.
2022-12-30T13:41:24.990Z Info: Searching for ltex-ls in '/Users/<redacted>/.vscode/extensions/valentjn.vscode-ltex-13.1.0/lib'...
2022-12-30T13:41:24.990Z Info: ltex-ls found in '/Users/<redacted>/.vscode/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0'.
2022-12-30T13:41:24.990Z Info: 
2022-12-30T13:41:24.990Z Info: Using ltex-ls from '/Users/<redacted>/.vscode/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0'.
2022-12-30T13:41:24.990Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set.
2022-12-30T13:41:24.990Z Info: Testing ltex-ls...
2022-12-30T13:41:24.990Z Info:   Command: "/Users/<redacted>/.vscode/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0/bin/ltex-ls"
2022-12-30T13:41:24.990Z Info:   Arguments: ["--version"]
2022-12-30T13:41:24.990Z Info:   env['JAVA_HOME']: undefined
2022-12-30T13:41:24.990Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2022-12-30T13:41:25.020Z Error: Test failed.
2022-12-30T13:41:25.020Z Error: Error details:
2022-12-30T13:41:25.020Z Info: ltex-ls terminated with non-zero exit code 1.
2022-12-30T13:41:25.020Z Info: stdout of ltex-ls:
2022-12-30T13:41:25.020Z Info: 
2022-12-30T13:41:25.020Z Info: stderr of ltex-ls:
2022-12-30T13:41:25.020Z Info: /Users/<redacted>/.vscode/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0/bin/ltex-ls: line 121: /Users/<redacted>/.vscode/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0/jdk-11.0.12+7/bin/java: Bad CPU type in executable
2022-12-30T13:41:25.020Z Info: /Users/<redacted>/.vscode/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0/bin/ltex-ls: line 121: /Users/<redacted>/.vscode/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0/jdk-11.0.12+7/bin/java: Undefined error: 0
2022-12-30T13:41:25.020Z Info: 
2022-12-30T13:41:25.022Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.

Version information
List here the version information of the relevant software.

  • Operating system: macOS Ventura 13.1 (Apple Silicon M1)
  • VS Code: 1.74.2
  • vscode-ltex: 13.1.0
  • ltex-ls: x.xx (only if not using ltex-ls automatically downloaded by LTeX)
  • Java: x.xx (usually obtained with java -version, only if not using Java automatically downloaded by LTeX)

Additional context/information
The bundled Java exists in /Users//.vscode/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0/jdk-11.0.12+7

@k2pctdn k2pctdn added 1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label) labels Dec 30, 2022
@adamaltmejd
Copy link

I get the same error (also on M1 Mac)

@BusHero
Copy link

BusHero commented Jan 25, 2023

I got the same error when running inside a dev container. It works however on Windows

@kir68k
Copy link

kir68k commented Mar 25, 2023

Had the same issue, which I resolved by installing ltex-ls through brew, and setting a few config options:

    "ltex.ltex-ls.path": "/usr/local",
    "ltex.java.path": "/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home"

The JAVA_HOME setting I figured out using this SO comment.

A new problem arises for me though, where VSCode is stuck on Starting LTeX..., without giving any errors, and there being an ltex-ls process running as reported in htop.
I do not know why this happens, especially as on Linux (Arch/Debian) it all works fine.

EDIT
On another machine running Ventura, I didn't have to do any of this, and only had to install the extension, then it works seamlessly...

@mengsigao
Copy link

Have the same issue on windows

2023-08-13T16:45:37.535Z Info: Setting LTeX UI language to 'en-us'.
2023-08-13T16:45:37.535Z Info: Loading i18n messages...
2023-08-13T16:45:37.537Z Info: Loading default i18n messages...
2023-08-13T16:45:37.541Z Info: 
2023-08-13T16:45:37.541Z Info: ltex.ltex-ls.path not set.
2023-08-13T16:45:37.541Z Info: Searching for ltex-ls in 'c:\Users\mengs\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib'...
2023-08-13T16:45:37.542Z Info: ltex-ls found in 'c:\Users\mengs\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'.
2023-08-13T16:45:37.542Z Info: 
2023-08-13T16:45:37.542Z Info: Using ltex-ls from 'c:\Users\mengs\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'.
2023-08-13T16:45:37.542Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set.
2023-08-13T16:45:37.544Z Info: Testing ltex-ls...
2023-08-13T16:45:37.544Z Info:   Command: "c:\\Users\\mengs\\.vscode\\extensions\\valentjn.vscode-ltex-13.1.0\\lib\\ltex-ls-15.2.0\\bin\\ltex-ls.bat"
2023-08-13T16:45:37.544Z Info:   Arguments: ["--version"]
2023-08-13T16:45:37.544Z Info:   env['JAVA_HOME']: undefined
2023-08-13T16:45:37.544Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2023-08-13T16:45:39.006Z Error: Test failed.
2023-08-13T16:45:39.006Z Error: Error details:
2023-08-13T16:45:39.006Z Info: ltex-ls terminated with non-zero exit code 1.
2023-08-13T16:45:39.006Z Info: stdout of ltex-ls:
2023-08-13T16:45:39.006Z Info: {
2023-08-13T16:45:39.006Z Info:   "ltex-ls": "15.2.0",
2023-08-13T16:45:39.006Z Info:   "java": "11.0.12"
2023-08-13T16:45:39.006Z Info: }
2023-08-13T16:45:39.006Z Info: 
2023-08-13T16:45:39.006Z Info: stderr of ltex-ls:
2023-08-13T16:45:39.006Z Info: The system cannot find the path specified.
2023-08-13T16:45:39.006Z Info: 
2023-08-13T16:45:39.006Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.
2023-08-13T16:47:19.564Z Info: 
2023-08-13T16:47:19.564Z Info: ltex.ltex-ls.path not set.
2023-08-13T16:47:19.565Z Info: Searching for ltex-ls in 'c:\Users\mengs\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib'...
2023-08-13T16:47:19.565Z Info: ltex-ls found in 'c:\Users\mengs\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'.
2023-08-13T16:47:19.565Z Info: 
2023-08-13T16:47:19.565Z Info: Using ltex-ls from 'c:\Users\mengs\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'.
2023-08-13T16:47:19.565Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set.
2023-08-13T16:47:19.566Z Info: Testing ltex-ls...
2023-08-13T16:47:19.566Z Info:   Command: "c:\\Users\\mengs\\.vscode\\extensions\\valentjn.vscode-ltex-13.1.0\\lib\\ltex-ls-15.2.0\\bin\\ltex-ls.bat"
2023-08-13T16:47:19.566Z Info:   Arguments: ["--version"]
2023-08-13T16:47:19.566Z Info:   env['JAVA_HOME']: undefined
2023-08-13T16:47:19.566Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2023-08-13T16:47:20.212Z Error: Test failed.
2023-08-13T16:47:20.212Z Error: Error details:
2023-08-13T16:47:20.212Z Info: ltex-ls terminated with non-zero exit code 1.
2023-08-13T16:47:20.212Z Info: stdout of ltex-ls:
2023-08-13T16:47:20.212Z Info: {
2023-08-13T16:47:20.212Z Info:   "ltex-ls": "15.2.0",
2023-08-13T16:47:20.212Z Info:   "java": "11.0.12"
2023-08-13T16:47:20.212Z Info: }
2023-08-13T16:47:20.212Z Info: 
2023-08-13T16:47:20.212Z Info: stderr of ltex-ls:
2023-08-13T16:47:20.212Z Info: The system cannot find the path specified.
2023-08-13T16:47:20.212Z Info: 
2023-08-13T16:47:20.214Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label)
Projects
None yet
Development

No branches or pull requests

5 participants