Starting eclipse with configured JVM from windows batch file

I have problems to start eclipse with a proper configured JVM from windows batch file. I like to do it this way, because I have different workspaces, different eclipse versions, different java versions and different configurations.

I guess the problem is the way I pass the parameters. I have tried several combinations of setting ‘”‘, but none worked. Below is just one example.

Anyway, can someone help? Thanks ๐Ÿ™‚

Afterwards added: Sorry, I forgot – the problem is the parameters for the JVM are neglected

@echo off
ver
echo.

set thePathToJDK=C:Program FilesAdoptOpenJDKjdk-11.0.10x9-hotspot

rem to be checked - is JAVA_HOME needed by anyone ?
rem eclipse states that is neglecting JAVA_HOME
set JAVA_HOME=%thePathToJDK%

rem set path to vm ( shall be in harmony with path to JDK )
set thePathToJVM=%thePathToJDK%binjavaw

set thePathToEclipse=C:eclipse ...

set thePathToEclipseWorkSpace=C: ...

rem set minimal path (for ECLIPSE/JAVA)
set theNewPath=%SystemRoot%system32
set theNewPath=%theNewPath%;%SystemRoot%
set theNewPath=%theNewPath%;%SystemRoot%System32Wbem
set theNewPath=%theNewPath%;%SystemRoot%System32WindowsPowerShellv1.0
set path=%thePathToJDK%bin;%theNewPath%
echo.
echo path used for ECLIPSE
echo %path%

set theCommand=%thePathToEclipse%eclipse.exe   -data "%thePathToEclipseWorkSpace%"   -vm "%thePathToJVM%"   -vmargs -ea -Xmx4096m -Xss256m
echo.
echo %theCommand%

rem start eclipse with preconfigured Java
cmd /c %theCommand%

pause

Answer

As @greg-449 pointed out, “the parameters” only change the Java that Eclipse itself uses. What I wanted cannot be done the way I wanted it to be done ๐Ÿ™

Leave a Reply

Your email address will not be published. Required fields are marked *