Repository navigation
Closed
microsoft/java-debug
#457Closed
Copy link
Description
I'm trying to play with running minecraft forge mods from VS Code. It fails because, the command line generated by the launch config is too long (apparently), so vscode fails to launch the client.
The Forge team generates extra long vmArgs, as seen below, that most likely make the whole command too long to run properly
{
"type": "java",
"name": "runClient",
"request": "launch",
"mainClass": "cpw.mods.bootstraplauncher.BootstrapLauncher",
"projectName": "examplemod",
"cwd": "${workspaceFolder}/run",
"vmArgs": "-Dforge.logging.console.level\u003ddebug -Dforge.logging.markers\u003dREGISTRIES -DlegacyClassPath.file\u003d/Users/fbricon/Downloads/examplemod/build/classpath/runClient_minecraftClasspath.txt -DignoreList\u003dbootstraplauncher,securejarhandler,asm-commons,asm-util,asm-analysis,asm-tree,asm,JarJarFileSystems,client-extra,fmlcore,javafmllanguage,lowcodelanguage,mclanguage,forge- -DmergeModules\u003djna-5.10.0.jar,jna-platform-5.10.0.jar -Dforge.enabledGameTestNamespaces\u003dexamplemod -Dforge.enableGameTest\u003dtrue -Djava.net.preferIPv6Addresses\u003dsystem -p /Users/fbricon/.gradle/caches/modules-2/files-2.1/cpw.mods/bootstraplauncher/1.1.2/c546e00443d8432cda6baa1c860346980742628/bootstraplauncher-1.1.2.jar:/Users/fbricon/.gradle/caches/modules-2/files-2.1/cpw.mods/securejarhandler/2.1.4/f47e3b9dd860a7b82154b8f90a650ffd0aaa5582/securejarhandler-2.1.4.jar:/Users/fbricon/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.3/1f2a432d1212f5c352ae607d7b61dcae20c20af5/asm-commons-9.3.jar:/Users/fbricon/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.3/9595bc05510d0bd4b610188b77333fe4851a1975/asm-util-9.3.jar:/Users/fbricon/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.3/4b071f211b37c38e0e9f5998550197c8593f6ad8/asm-analysis-9.3.jar:/Users/fbricon/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.3/78d2ecd61318b5a58cd04fb237636c0e86b77d97/asm-tree-9.3.jar:/Users/fbricon/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.3/8e6300ef51c1d801a7ed62d07cd221aca3a90640/asm-9.3.jar:/Users/fbricon/.gradle/caches/modules-2/files-2.1/net.minecraftforge/JarJarFileSystems/0.3.16/e52afbb2599dc7c6f779efea0496d32fc01152e3/JarJarFileSystems-0.3.16.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar\u003dcpw.mods.securejarhandler --add-opens java.base/java.lang.invoke\u003dcpw.mods.securejarhandler --add-exports java.base/sun.security.util\u003dcpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns\u003djava.naming -XstartOnFirstThread -Xss1M",
"args": "--launchTarget forgeclientuserdev --version MOD_DEV --assetIndex 1.19 --assetsDir /Users/fbricon/.gradle/caches/forge_gradle/assets --gameDir . --fml.forgeVersion 43.1.47 --fml.mcVersion 1.19.2 --fml.forgeGroup net.minecraftforge --fml.mcpVersion 20220805.130853",
"env": {
"MOD_CLASSES": "examplemod%%${workspaceFolder}/bin/main:examplemod%%${workspaceFolder}/bin/main",
"MCP_MAPPINGS": "official_1.19.2"
}
},
those vmArgs could be included in the generated argFiles when "shortenCommandLine": "argfile", or "shortenCommandLine": "auto" is set,
Environment
- Operating System: MacOS Ventura 13.0
- JDK version: 17.0.1-tem
- Visual Studio Code version: 1.73.0
- Java extension version: 1.12
- Java Debugger extension version: v0.46.2022103114
Steps To Reproduce
- unzip attached examplemod.zip
- In a terminal, run
./gradlew genVSCodeRuns, that will generate the.vscode/launch.jsonfor your machine - Open folder in VS Code
- After import is complete, run the
runClientlaunch config
Current Result
Expected Result
Minecraft should launch

Activity
testforstephen commentedon Nov 7, 2022
It makes sense to add the long vmArgs to the generated argfile.
testforstephen commentedon Nov 11, 2022
Tried the sample examplemod.zip on Windows, it can run well using cmd. In theory, the maximum command line limitation on macOS is larger than Windows terminal, this project should not exceed the length limitation.
Anyway, a quick workaround to shorten command line is to manually create a vmargs.argfile in current workspace folder with the value of "vmArgs" , and then add
"vmArgs": "@${workspaceFolder}/vmargs.argfile"to launch.json. In vmargs.argfile, you may need to replace the unicode\u003dto=as well.fbricon commentedon Nov 11, 2022
Manually modifying the launch config after each
./gradlew genVSCodeRunsinvocation doesn't scaletestforstephen commentedon Nov 15, 2022
Fred Bricon (@fbricon) this has been fixed in the pre-release version of Java Debug extension, feel free to have a try.
fbricon commentedon Nov 15, 2022
Thanks it works now!