Here is a good resource to check out first
First of all, check what command is run when you in fact launch your app. For me (Create minecraft mod) this command was executed when I run runClient
configuration (line breaks, tabs and backslashes added for readability):
/home/tooster/.sdkman/candidates/java/14.0.1-open/bin/java
-Dforge.logging.console.level=info
-Dfml.earlyprogresswindow=false
-Dmixin.env.disableRefMap=true
-javaagent:\
/home/tooster/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7442.40/lib/idea_rt.jar=36385:\
/home/tooster/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7442.40/bin
-Dfile.encoding=UTF-8
-classpath
/home/tooster/workspace/ttr/Create/build/classes/java/main:\
/home/tooster/workspace/ttr/Create/build/resources/main:\
/home/tooster/.gradle/caches/forge_gradle/deobf_dependencies/com/tterrag/registrate/Registrate/MC1.16.5-1.0.4_mapped_snapshot_20200920-mixed-1.16.3/Registrate-MC1.16.5-1.0.4_mapped_snapshot_20200920-mixed-1.16.3.jar:\
/home/tooster/.gradle/caches/forge_gradle/deobf_dependencies/com/jozufozu/flywheel/Flywheel/1.16-0.0.3.20_mapped_snapshot_20200920-mixed-1.16.3/Flywheel-1.16-0.0.3.20_mapped_snapshot_20200920-mixed-1.16.3.jar:\
/home/tooster/.gradle/caches/forge_gradle/deobf_dependencies/com/ferreusveritas/dynamictrees/DynamicTrees-1.16.5/0.10.0-Beta12.1_mapped_snapshot_20200920-mixed-1.16.3/DynamicTrees-1.16.5-0.10.0-Beta12.1_mapped_snapshot_20200920-mixed-1.16.3.jar:\
/home/tooster/workspace/ttr/Create/build/fg_cache/net/minecraftforge/forge/1.16.5-36.1.32_mapped_snapshot_20200920-mixed-1.16.3/forge-1.16.5-36.1.32_mapped_snapshot_20200920-mixed-1.16.3-recomp.jar:\
/home/tooster/workspace/ttr/Create/build/fg_cache/net/minecraftforge/forge/1.16.5-36.1.32_mapped_snapshot_20200920-mixed-1.16.3/forge-1.16.5-36.1.32_mapped_snapshot_20200920-mixed-1.16.3-launcher.jar:\
/home/tooster/.gradle/caches/forge_gradle/minecraft_repo/versions/1.16.5/client-extra.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.minecraftforge/mergetool/1.0.9/d1e1ba354a40b5703340b5cb02fdca489cff3646/mergetool-1.0.9-api.jar:\
/home/tooster/.gradle/caches/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot/20200920-mixed-1.16.3/mcp_snapshot-20200920-mixed-1.16.3.zip:\
/home/tooster/.gradle/caches/modules-2/files-2.1/cpw.mods/modlauncher/8.0.9/bb848f57758808692b9108df61c909c0a961ba81/modlauncher-8.0.9.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.0/5a34a3a9ac44f362f35d1b27932380b0031a3334/asm-commons-9.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.0/7c059a94ab5eed3347bf954e27fab58e52968848/asm-util-9.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.0/4630afefbb43939c739445dde0af1a5729a0fb4e/asm-analysis-9.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.0/9df939f25c556b0c7efe00701d47e77a49837f24/asm-tree-9.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.0/af582ff60bc567c42d931500c3fdc20e0141ddf9/asm-9.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/cpw.mods/grossjava9hacks/1.3.3/e49222512ea6cabdd8b49761cef1d5a207b1f0d9/grossjava9hacks-1.3.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.minecraftforge/accesstransformers/3.0.1/6d23c1b9cb0607fddc38d09730796f68db96f546/accesstransformers-3.0.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.antlr/antlr4-runtime/4.9.1/428664f05d2b7f7b7610204b5aa7c1763f62011a/antlr4-runtime-4.9.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.minecraftforge/eventbus/4.0.0/260e34800723e4c098c4e247cf2b900535e01b6d/eventbus-4.0.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.minecraftforge/forgespi/3.2.0/c6ca4e4e4a0343701407c760e642537b613b543/forgespi-3.2.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.minecraftforge/coremods/4.0.6/d6d761379c841e2610abebcbf70ed20b65f728f0/coremods-4.0.6.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.minecraftforge/unsafe/0.2.0/54d7a0a5e8fdb71b973025caa46f341ae5904f39/unsafe-0.2.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.electronwill.night-config/toml/3.6.3/2b05b4d606c517da4d1a7b6d2b97d751c92887d7/toml-3.6.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.electronwill.night-config/core/3.6.3/c601bfeaeb2c0abe7aaa901b0bbe6d1beff49281/core-3.6.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.jline/jline/3.12.1/de2bd909cb9f8eaa741bd03df4a1bd3f6eb593c7/jline-3.12.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.6.3/f8ff8032903882376e8d000c51e3e16d20fc7df7/maven-artifact-3.6.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.jodah/typetools/0.8.3/98f84f353457629e81cc6827224871b1a8faa7af/typetools-0.8.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.minecrell/terminalconsoleappender/1.2.0/96d02cd3b384ff015a8fef4223bcb4ccf1717c95/terminalconsoleappender-1.2.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.11.2/6c2fb3f5b7cd27504726aef1b674b542a0c9cf53/log4j-core-2.11.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.11.2/f5e9a2ffca496057d6891a3de65128efc636e26e/log4j-api-2.11.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.sf.jopt-simple/jopt-simple/5.0.4/4fdac2fbe92dfad86aa6e9301736f6b4342a3f5c/jopt-simple-5.0.4.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8.2/1cf212283d26f706fd3074318870bebd14d2a9ed/mixin-0.8.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.minecraftforge/nashorn-core-compat/15.1.1.1/1817deb38a5a8811148dca0d23161d92bdbd6184/nashorn-core-compat-15.1.1.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.mojang/patchy/1.2.3/e3107ca512d704a434076a153a6e1149e3787275/patchy-1.2.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/oshi-project/oshi-core/1.1/9ddf7b048a8d701be231c0f4f95fd986198fd2d8/oshi-core-1.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.java.dev.jna/jna/4.4.0/cb208278274bf12ebdb56c61bd7407e6f774d65a/jna-4.4.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.java.dev.jna/platform/3.4.0/e3f70017be8100d3d6923f50b3d2ee17714e9c13/platform-3.4.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.ibm.icu/icu4j/66.1/72c7519b6d91f7a1f993bd44a99fe95d67211b27/icu4j-66.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.mojang/javabridge/1.0.22/6aa6453aa99a52a5cd91749da1af6ab70e082ab3/javabridge-1.0.22.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/io.netty/netty-all/4.1.25.Final/d0626cd3108294d1d58c05859add27b4ef21f83b/netty-all-4.1.25.Final.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/21.0/3a3d111be1be1b745edfa7d91678a12d7ed38709/guava-21.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.8.1/6505a72a097d9270f7a9e7bf42c4238283247755/commons-lang3-3.8.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.5/2852e6e05fbb95076fc091f6d1780f1f8fe35e0f/commons-io-2.5.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient/4.3.3/18f4247ff4572a074444572cee34647c43e7c9c7/httpclient-4.3.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.10/4b95f4897fa13f2cd904aee711aeafc0c5295cd8/commons-codec-1.10.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput/2.0.5/39c7796b469a600f72380316f6b1f11db6c2c7c4/jinput-2.0.5.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.java.jutils/jutils/1.0.0/e12fe1fda814bd348c1579329c86943d2cd3c6a6/jutils-1.0.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.mojang/brigadier/1.0.17/c6b7dc51dd44379cc751b7504816006e9be4b1e6/brigadier-1.0.17.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.mojang/datafixerupper/4.0.26/ebd6690f33871ccee9b6132c6480668ee2e35020/datafixerupper-4.0.26.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.8.0/c4ba5371a29ac9b2ad6129b1d39ea38750043eff/gson-2.8.0.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.mojang/authlib/2.1.28/ad54da276bf59983d02d5ed16fc14541354c71fd/authlib-2.1.28.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-compress/1.8.1/a698750c16740fd5b3871425f4cb3bbaa87f529d/commons-compress-1.8.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.3/f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f/commons-logging-1.1.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.3.2/31fbbff1ddbf98f3aa7377c94d33b0447c646b6e/httpcore-4.3.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/it.unimi.dsi/fastutil/8.2.1/5ad88f325e424f8dbc2be5459e21ea5cab3864e9/fastutil-8.2.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-jemalloc/3.2.2/ee8e57a79300f78294576d87c4a587f8c99402e2/lwjgl-jemalloc-3.2.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-openal/3.2.2/2b772a102b0a11ee5f2109a5b136f4dc7c630827/lwjgl-openal-3.2.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.2.2/6ac5bb88b44c43ea195a570aab059f63da004cd8/lwjgl-opengl-3.2.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.2.2/d3ad4df38e400b8afba1de63f84338809399df5b/lwjgl-glfw-3.2.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-stb/3.2.2/3b8e6ebc5851dd3d17e37e5cadce2eff2a429f0f/lwjgl-stb-3.2.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-tinyfd/3.2.2/fcbe606c8f8da6f8f9a05e2c540eb1ee8632b0e9/lwjgl-tinyfd-3.2.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.2.2/8ad6294407e15780b43e84929c40e4c5e997972e/lwjgl-3.2.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.mojang/text2speech/1.11.3/f378f889797edd7df8d32272c06ca80a1b6b0f58/text2speech-1.11.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.codehaus.plexus/plexus-utils/3.2.1/13b015768e0d04849d2794e4c47eb02d01a0de32/plexus-utils-3.2.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.jline/jline-reader/3.12.1/4382ab1382c7b6f379377ed5f665dc2f6e1218bc/jline-reader-3.12.1.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.jline/jline-terminal/3.12.1/c777448314e050d980a6b697c140f3bfe9eb7416/jline-terminal-3.12.1.jar:\
/home/tooster/.gradle/caches/forge_gradle/deobf_dependencies/mezz/jei/jei-1.16.5/7.7.0.106_mapped_snapshot_20200920-mixed-1.16.3/jei-1.16.5-7.7.0.106_mapped_snapshot_20200920-mixed-1.16.3.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/cpw.mods/modlauncher/8.0.9/476a62d2a2ebd3573134b8bcd8f0bc21bbdf29ac/modlauncher-8.0.9-api.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/3.0.2/25ea2e8b0c338a877313bd4672d3fe056ea78f0d/jsr305-3.0.2.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-jemalloc/3.2.2/268c08a150347e04e44ba56e359d62c9b78669df/lwjgl-jemalloc-3.2.2-natives-linux.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-openal/3.2.2/364f9f5c3947393083ab5f37a571f5603aadd0b/lwjgl-openal-3.2.2-natives-linux.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-opengl/3.2.2/338d33387919cb3f4cdba143c2b738a71ccfda60/lwjgl-opengl-3.2.2-natives-linux.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-glfw/3.2.2/957733f26a6661d4883da0335f7ef46d3bbbd7d/lwjgl-glfw-3.2.2-natives-linux.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-stb/3.2.2/172c52e586fecf43f759bc4f70a778c01f6fdcc1/lwjgl-stb-3.2.2-natives-linux.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl-tinyfd/3.2.2/39e35b161c130635d9c8918ce04e887a30c5b687/lwjgl-tinyfd-3.2.2-natives-linux.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/org.lwjgl/lwjgl/3.2.2/ae7976827ca2a3741f6b9a843a89bacd637af350/lwjgl-3.2.2-natives-linux.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/com.mojang/text2speech/1.11.3/ac641755a2a841d1fca9e660194f42523ee5cfe0/text2speech-1.11.3-natives-linux.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput-platform/2.0.5/7ff832a6eb9ab6a767f1ade2b548092d0fa64795/jinput-platform-2.0.5-natives-linux.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput-platform/2.0.5/53f9c919f34d2ca9de8c51fc4e1e8282029a9232/jinput-platform-2.0.5-natives-osx.jar:\
/home/tooster/.gradle/caches/modules-2/files-2.1/net.java.jinput/jinput-platform/2.0.5/385ee093e01f587f30ee1c8a2ee7d408fd732e16/jinput-platform-2.0.5-natives-windows.jar
net.minecraftforge.userdev.LaunchTesting
-mixin.config=create.mixins.json
The most important is the first line - it's running java executable with further arguments. Important thing without which the whole process won't work is setting up environment variables that the task defines. For me it was as seen below (again, for readability split into lines):
MOD_CLASSES=create%%/home/tooster/workspace/ttr/Create/build/resources/main:create%%/home/tooster/workspace/ttr/Create/build/classes/java/main;\
MCP_MAPPINGS=snapshot_20200920-mixed-1.16.3;\
MCP_VERSION=20210115.111550;\
FORGE_VERSION=36.1.32;\
assetIndex=1.16;\
assetDirectory=/home/tooster/.gradle/caches/forge_gradle/assets;\
nativesDirectory=/home/tooster/workspace/ttr/Create/build/natives;\
FORGE_GROUP=net.minecraftforge;\
target=fmluserdevclient;\
MC_VERSION=1.16.5
The command is by default in the Run window in IntelliJ when you unfold the first line. The envirnonment setup can be found when editing the runClient
configuration (Environment Variables field).
To make it fully work we also need some way to attach to the process started by renderdoc inside intelliJ if we want to debug (but this will lag like ass, so watch out). For that we create new run configuration from template "Remote JVM Debug". Defaults are OK - we copy generated command line arguments of the task that should look like that:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
And now to Renderdoc:
in Launch Application window we set it up as follows:
- Executable Path: <first line of command - only the absolute path to java from step 1>
- Working Directory: <the run/ directory of our mod project, generated by task>
- Command Line Arguments:
- First, we paste in the content copied from Remote Debugging configuration, but change
suspend=n
tosuspend=y
for renderdoc to wait for debugger to attach. - After this is pasted we paste the rest of command copied in step 1 (so everything excluding first line with path to java)
- First, we paste in the content copied from Remote Debugging configuration, but change
- Environment Variables: <this is a little tedious due to the dialog with shitty input method, but we have to set up all variables that we got in step 2 - it's pretty intuitive, but each variable has to be set one by one. I didn't put semicolons at the end>
- Capture options - do what you want, I went with defaullt of checked VSync and Fullscreen only.
Now you can launch this configuration. When you launch the app via renderdoc it will wait for debugger to attach, so in intelliJ select your created Remote JVM Debug and launch it. This will take time, but now a process runs in a background that launches you MC instance. logs can be viewed under run/logs/latest.log
in your mod - that's how I in fact recognized that it's launching and not just dead :).
It's ofc easy to extrapolate this info to any other java app.
Guide by Tooster aka T3sT3ro.
@funnbot Thank you for your tip! Worked perfectly for me.
Convenience task for my
build.gradle.kts
: