I'm writing a simple batch script to execute a game quicker (for a dev environment purpose), however I seem to be unable to pass the appropriate command-line arguments to the executable:
@ECHO OFF
set USERNAME=Testing
set MCDIR=%APPDATA%/.minecraft/
set GAMEDIR=%MCDIR%/versions/1.7.5/
set NATIVES=%GAMEDIR%/natives/
java -client -Xmx512M -Xms512M ^
-Djava.library.path=%NATIVES% ^
-cp %GAMEDIR%/1.7.5.jar:^
%MCDIR%/libraries/java3d/vecmath/1.3.1/vecmath-1.3.1.jar:^
%MCDIR%/libraries/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar:^
##etc... lots of libs
%MCDIR%/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.1/lwjgl_util-2.9.1.jar:^
%MCDIR%/libraries/org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-windows.jar:^
%MCDIR%/libraries/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar:^
net.minecraft.client.main.Main --username=%USERNAME% --version 1.7.5 --gameDir %MCDIR% --assetsDir %MCDIR%/assets --userProperties {} --accessToken Offline
pause
However this small script seems to fail the instant it goes beyond client.main.Main
with any argument, effectively treating it as a JVM argument rather than a command-line program argument. Is there a different way to go about doing this when using -cp
rather than -jar
for calling a program in java? If not, what am I doing wrong?
It appears that there is no space between the end of your path (the last ^
) and your Main
class, so your Main
class is effectively part of the -cp
JVM argument. There is no class yet, so java
still sees JVM args.
Try putting a space after the last part of the -cp
value and your net.minecraft.client.main.Main
, to separate the -cp
value and your class on the command line.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.