@echo off setlocal REM ============================================================ REM JDTLS wrapper for LSP Gateway (stdio mode) REM Put this script somewhere in PATH, or use full path in config REM ============================================================ REM --- JDTLS install location (auto-detect from this script's directory) --- set "JDTLS_HOME=%~dp0" if "%JDTLS_HOME:~-1%"=="\" set "JDTLS_HOME=%JDTLS_HOME:~0,-1%" REM --- Java (change this if needed) --- if defined JAVA_HOME ( set "JAVA=%JAVA_HOME%\bin\java.exe" ) else ( set "JAVA=java" ) REM --- Find launcher JAR --- for %%f in ("%JDTLS_HOME%\plugins\org.eclipse.equinox.launcher_*.jar") do ( set "LAUNCHER=%%f" ) REM --- Config directory --- set "CONFIG_DIR=%JDTLS_HOME%\config_win" REM --- Workspace: use per-instance workspace to avoid lock conflicts --- REM Supports JDTLS_WORKSPACE env var for explicit override. if defined JDTLS_WORKSPACE ( set "WORKSPACE_DIR=%JDTLS_WORKSPACE%" ) else ( set "WORKSPACE_DIR=%TEMP%\jdtls-ws-%RANDOM%%RANDOM%" ) if not exist "%WORKSPACE_DIR%" mkdir "%WORKSPACE_DIR%" REM --- Launch JDTLS in stdio mode --- "%JAVA%" ^ -Declipse.application=org.eclipse.jdt.ls.core.id1 ^ -Dosgi.bundles.defaultStartLevel=4 ^ -Declipse.product=org.eclipse.jdt.ls.core.product ^ -Dlog.level=ALL ^ -Xmx1G ^ --add-modules=ALL-SYSTEM ^ --add-opens java.base/java.util=ALL-UNNAMED ^ --add-opens java.base/java.lang=ALL-UNNAMED ^ -jar "%LAUNCHER%" ^ -configuration "%CONFIG_DIR%" ^ -data "%WORKSPACE_DIR%" endlocal