{"record":{"id":"b566a579de700b64","repo":"Anuken/Mindustry","slug":"java-class-mods-are-not-supported-on-ios","errorCode":null,"errorMessage":"Java class mods are not supported on iOS.","messagePattern":"Java class mods are not supported on iOS\\.","errorType":"validation","errorClass":"ModLoadException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/mod/Mods.java","lineNumber":1165,"sourceCode":"                        mainFile = mainFile.child(str);\n                    }\n                }\n            }\n\n            //make sure the main class exists before loading it; if it doesn't just don't put it there\n            //if the mod is explicitly marked as java, try loading it anyway\n            if(\n                (mainFile.exists() || meta.java) &&\n                !skipModLoading() &&\n                Core.settings.getBool(\"mod-\" + baseName + \"-enabled\", true) &&\n                Version.isAtLeast(meta.minGameVersion) &&\n                (meta.getMinMajor() >= minJavaModGameVersion || headless || meta.legacyCompatible) &&\n                !meta.isBlacklisted() &&\n                !skipModCode &&\n                initialize\n            ){\n                if(ios){\n                    throw new ModLoadException(\"Java class mods are not supported on iOS.\");\n                }\n\n                loader = platform.loadJar(sourceFile, mainLoader);\n                mainLoader.addChild(loader);\n                Class<?> main = Class.forName(mainClass, true, loader);\n\n                //detect mods that incorrectly package mindustry in the jar\n                if((main.getSuperclass().getName().equals(\"mindustry.mod.Plugin\") || main.getSuperclass().getName().equals(\"mindustry.mod.Mod\")) &&\n                    main.getSuperclass().getClassLoader() != Mod.class.getClassLoader()){\n                    throw new ModLoadException(\n                        \"This mod/plugin has loaded Mindustry dependencies from its own class loader. \" +\n                        \"You are incorrectly including Mindustry dependencies in the mod JAR - \" +\n                        \"make sure Mindustry is declared as `compileOnly` in Gradle, and that the JAR is created with `runtimeClasspath`!\"\n                    );\n                }\n\n                metas.put(main, meta);\n                mainMod = (Mod)main.getDeclaredConstructor().newInstance();","sourceCodeStart":1147,"sourceCodeEnd":1183,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/mod/Mods.java#L1147-L1183","documentation":"iOS does not support dynamically loading Java class mods (no runtime JVM classloading), so when a Java mod reaches the load path on iOS, loadMod throws ModLoadException. This is a hard platform limitation, not a configuration issue.","triggerScenarios":"A mod with a Java main class (mainFile exists or meta.java) attempts to load on an iOS build.","commonSituations":"Cross-platform mod distributed to iOS users; mod author unaware iOS forbids Java code.","solutions":["Use a content-only mod (JSON, no Java main class) for iOS support.","Inform iOS users the Java mod is unsupported on their platform.","Set meta so the code path is skipped where possible."],"exampleFix":"// before: mod with classes + main class -> 'Java class mods are not supported on iOS.'\n// after: ship a content-only variant (remove classes/ and meta.main) for iOS","handlingStrategy":"validation","validationCode":"// Gate Java-mod loading by platform.\nif(ios && (mainFile.exists() || meta.java)) {\n    throw new ModLoadException(\"Java class mods are not supported on iOS.\");\n}","typeGuard":"boolean javaModOnUnsupportedPlatform(boolean ios, ModMeta meta, Fi mainFile){\n    return ios && (mainFile.exists() || meta.java);\n}","tryCatchPattern":"try {\n    mods.loadMod(file);\n} catch(ModLoadException e) {\n    if(e.getMessage().contains(\"not supported on iOS\")) { /* provide content-only variant */ }\n    else throw e;\n}","preventionTips":["Ship content-only (no Java) variants for iOS.","Document platform support per mod.","Skip code loading on iOS in distribution metadata."],"tags":["modding","platform","ios","classloading"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}