pxb1988/dex2jar · error · RuntimeException

version not support yet!

Error message

version not support yet!

What it means

ClassVersionSwitch's CLI accepts a version index 1-9 which it maps into an actual Java class-file major version via the jVersions table. Any number outside 1..9 has no table entry, so it throws this immediately after parsing args.

Solutions

  1. Pass an index between 1 and 9 corresponding to the Java version (see jVersions mapping in the tool)
  2. Check the tool usage output: `clz-version-switch version old.jar new.jar`
  3. If you need a version outside the 1-9 table, extend jVersions and the bounds check in ClassVersionSwitch.java:39

Example fix

// before
clz-version-switch 52 old.jar new.jar
// after
clz-version-switch 4 old.jar new.jar
Defensive patterns

Strategy: validation

Validate before calling

int v = Integer.parseInt(args[0]);
if (v < 1 || v > 9) throw new IllegalArgumentException("version index must be 1-9, got " + v);

Try / catch

try { ClassVersionSwitch.main(args); } catch (RuntimeException e) { if (e.getMessage().contains("version not support")) { printUsageWithValidVersions(); } }

Prevention

When it happens

Trigger: Running `clz-version-switch <version> old.jar new.jar` with a first argument that parses to an integer outside 1-9 (e.g. 0, 10, negative, or a raw Java version like 52).

Common situations: Users passing the actual class-file major version (45-69) instead of the tool's 1-9 index, or typos.

Related errors


AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08). Data as JSON: /api/errors/170820c64cb5fa60. Report an issue: GitHub.

Appendix: source

Thrown at dex-tools/src/main/java/com/googlecode/dex2jar/tools/ClassVersionSwitch.java:39

            Opcodes.V1_1,
            Opcodes.V1_2,
            Opcodes.V1_3,
            Opcodes.V1_4,
            Opcodes.V1_5,
            Opcodes.V1_6,
            Opcodes.V1_7,
            52,
            53,
    };

    public static void main(String... args) throws IOException {
        if (args.length < 3) {
            System.out.println("Usage: clz-version-switch version old.jar new.jar");
            System.exit(1);
        }
        int version = Integer.parseInt(args[0]);
        if (version < 1 || version > 9) {
            throw new RuntimeException("version not support yet!");
        }
        File old = new File(args[1]);
        File n = new File(args[2]);
        byte[] buff = new byte[1024 * 50];
        final int jVersion = jVersions[version];
        try (ZipFile zip = new ZipFile(old); ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(n));) {

            for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements(); ) {
                ZipEntry zipEntry = e.nextElement();
                zos.putNextEntry(new ZipEntry(zipEntry.getName()));
                if (!zipEntry.isDirectory()) {
                    try (InputStream is = zip.getInputStream(zipEntry)) {
                        if (zipEntry.getName().endsWith(".class")) {
                            ClassReader cr = new ClassReader(is);
                            ClassWriter cw = new ClassWriter(0);
                            ClassVisitor cv = new ClassVisitor(Opcodes.ASM9, cw) {
                                @Override
                                public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {

View on GitHub (pinned to b5bda4fb49)