class file

the Java Runtime (class file version 55.0), xxx recognizes class file versions up to 52.0 标题不够长,不能显示完整错误信息,完整错误信息如下; Cause: com/android/tools/idea/gradle/run/OutputBuildAction has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52. 阅读详情

import java.io.*;

public class ClassAnalyzer {

    public static void main(String[] args) {
        DataInputStream input = null;
        try {
            input = new DataInputStream(new BufferedInputStream(new FileInputStream("C://jdk1.2//bin//Test.class")));
            analyze(input);
        }
        catch(Exception e) {
            System.out.println("Analyze failed!");
        }
        finally {
            try {
                input.close();
            }
            catch(Exception ex) {
                ex.printStackTrace();
            }
        }
    }

    static void analyze(DataInputStream input) throws IOException {
        // read magic number:
        int java_magic = input.readInt();  //u4
        if(java_magic==0xCAFEBABE)
            System.out.println("magic number = 0xCAFEBABE");
        else
            throw new RuntimeException("Invalid magic number!or the input File isn't a classFile");
        // read minor version and major version:
        short minor_ver = input.readShort(); //00 03
        short major_ver = input.readShort(); //00 2D
        System.out.println(" MinorVersion = " + minor_ver + " MajorVersion=" + major_ver);
        // read constant pool:
        short const_pool_count = input.readShort();
        System.out.println("constant_pool_count = " + const_pool_count);
        // read each constant:
        for(int i=1; i<const_pool_count; i++) {
            analyzeConstant(input, i);
        }
    }

    public static void analyzeConstant(DataInputStream input, int index) throws IOException {
        byte flag = input.readByte(); //1B
        // for read:
        byte n8;    // 8bits
        short n16;  // 16bits
        int n32;    // 32bits
        long n64;   // 64bits
        float f;    // 32bits
        double d;   // 64bits
        byte[] buffer; //字节缓冲区
        System.out.println("/nconst index = " + index + ", flag = " + (int)flag);
        switch(flag) {
        case 1: // utf-8 string
            System.out.println(" const type = Utf8");
            n16 = input.readShort();
            System.out.println("     length = " + n16);
            buffer = new byte[n16];
            input.readFully(buffer);
            System.out.println("      value = " + new String(buffer));
            break;
        case 3: // integer
            System.out.println(" const type = Integer");
            n32 = input.readInt();
            System.out.println("      value = " + n32);
            break;
        case 4: // float
            System.out.println(" const type = Float");
            f = input.readFloat();
            System.out.println("      value = " + f);
            break;
        case 5: // long
            System.out.println(" const type = Long");
            n64 = input.readLong();
            System.out.println("      value = " + n64);
            break;
        case 6: // double
            System.out.println(" const type = Double");
            d = input.readDouble();
            System.out.println("      value = " + d);
            break;
        case 7: // class or interface reference
            System.out.println(" const type = Class");
            n16 = input.readShort();
            System.out.println("      index = " + n16 + " (where to find the class name)");
            break;
        case 8: // string
            System.out.println(" const type = String");
            n16 = input.readShort();
            System.out.println("      index = " + n16);
            break;
        case 9: // field reference
            System.out.println(" const type = Fieldreference");
            n16 = input.readShort();
            System.out.println("class index = " + n16 + " (where to find the class)");
            n16 = input.readShort();
            System.out.println("nameAndType = " + n16 + " (where to find the NameAndType)");
            break;
        case 10: // method reference
            System.out.println(" const type = Methodreference");
            n16 = input.readShort();
            System.out.println("class index = " + n16 + " (where to find the class)");
            n16 = input.readShort();
            System.out.println("nameAndType = " + n16 + " (where to find the NameAndType)");
            break;
        case 11: // interface method reference
            System.out.println(" const type = InterfaceMethodreference");
            n16 = input.readShort();
            System.out.println("class index = " + n16 + " (where to find the interface)");
            n16 = input.readShort();
            System.out.println("nameAndType = " + n16 + " (where to find the NameAndType)");
            break;
        case 12: // name and type reference
            System.out.println(" const type = NameAndType");
            n16 = input.readShort();
            System.out.println(" name index = " + n16 + " (where to find the name)");
            n16 = input.readShort();
            System.out.println(" des cripter = " + n16 + " (where to find the des criptor)");
            break;
        default:
            throw new RuntimeException("Invalid constant pool flag: " + flag);
        }
    }
}

【idea】 Unsupported class file major version 57 1.场景1 1.1 背景 mac环境下,想编译es 7.8 ,然后报错 [lcc@lcc ~/IdeaProjects/source_code/elasticsearch-7.8.1]$ gradle idea * What went wrong: Could not compile settings file '/Users/lcc/IdeaProjects/source_code/elasticsearch-7.8.1/buildSrc/settings.gradle'. > startup . 阅读详情

相关推荐

jd-gui反编译(windows)

支持反编译class文件,jar,zip等,窗口版本, windows下可直接运行。

JVM---ClassFile的文件结构解析

ClassFile的文件结构解析1.无符号数2.表3 ClassFile的文件结构解析3.1 magic(魔术)3.2 class文件版本号3.3 constant_pool_count3.4 constant_pool常量池详细解析常量类型总共有18个编号的常量类型。3.5 access_flag3.6 this_class3.7 super_class3.8 intefaces_count和 intefaces3.9 fields_count 和 fields3.10 method

qq_48186679的博客 601

KTransformers安装笔记 利用docker安装KTransformers

KTransformers安装笔记 利用docker安装KTransformers

guoqingru0311的博客 1563

java反编译

jvm 把Boolean类型的值flag当做int类型处理。​​​ Foo.java: public class Foo{ public static void main(String [] args){ boolean flag = true; if(flag) System.out.println("Hello Java!"); if(flag == true) Syste...

taylar1357的博客 934

DSH-Work:一个让DeepSeek下载即用的Harness客户端

使用大模型工具时,环境配置往往比模型本身更让人头疼。DeepSeek Harness作为一类封装层,将模型调用、上下文管理、参数控制等复杂细节统一收拢,对外提供简洁操作入口。开源的DSH-Work正是这样一款Harness客户端,它通过自带运行时与保守默认配置,实现了下载即用、免配环境的目标,让使用者无需掌握Python、CUDA等专业知识即可快速连接DeepSeek云端或本地服务。对于非技术背景的用户,它降低了AI工具的使用门槛;对于开发者,它把时间从环境排错中解放出来,更专注于提示词调优与工作流设计。无

weixin_29048309的博客 347

CANoe实战:手把手教你用J1939.dbc发送超8字节长帧报文(附完整CAPL代码)

本文详细解析了使用CANoe和J1939.dbc实现超8字节长帧报文的分包发送技术,提供完整的CAPL代码实现与优化策略。内容涵盖J1939.dbc配置、分包发送模块设计、接收端处理逻辑,并与ISO 15765-2协议进行深度对比,帮助开发者构建高效可靠的商用车通信解决方案。

weixin_29169899的博客 396

classfile解析

前言 在讲解内容之前我们要先了解什么是classfile:在java中,通过javac编译生成class文件,这个Class文件是一组以8个字节为基础单位的二进制字节流。各项数据会严格的按照顺序紧凑的排列在class文件中,中间没有分隔符,使得class文件存储的内容几乎全部都是程序运行的。 可以使用Sublime_Text,IDEA 中的插件 BinEd - Binary/HexadecimalEditor来查看classfile Classfile文件结构解析 class文件格式采用的类

weixin_46060794的博客 892

从Frenet坐标系到多项式拟合:Lattice Planner核心原理拆解与调参指南

本文深入解析了自动驾驶轨迹规划中Lattice Planner的核心原理,重点阐述了其在Frenet坐标系下解耦横纵向规划、利用五次和四次多项式拟合轨迹的数学基础。文章提供了从坐标系转换、采样策略到成本函数设计的完整工程实践指南,并分享了关键的参数调优经验,旨在帮助开发者高效实现稳定、平滑且安全的轨迹规划。

tech5的博客 1111

Java动态代理机制详解(JDK 和CGLIB,Javassist,ASM)

转载:https://louluan.blog.youkuaiyun.com/article/details/24589193 class文件简介及加载      Java编译器编译好Java文件之后,产生.class 文件在磁盘中。这种class文件是二进制文件,内容是只有JVM虚拟机能够识别的机器码。JVM虚拟机读取字节码文件,取出二进制数据,加载到内存中,解析.class 文件内的信息,

曲终人散 220

Lumerical FDTD新手必看:从零开始搭建光子晶体仿真环境(附完整脚本)

本文为Lumerical FDTD新手提供光子晶体仿真环境的完整搭建指南,涵盖从基础参数设置到脚本编写的全流程。通过典型光子晶体带隙分析案例,详细讲解结构建模、仿真参数配置及后处理技巧,并附赠完整MATLAB脚本,帮助用户快速掌握FDTD仿真核心技术。

3c4x5z6v7b的博客 1056

【Unity URP渲染管线下Shader的自定义物体半透明和投影半透明效果_半透明案例分享】

Unity Shader Graph URP渲染管线下的自定义半透明效果_半透明案例分享

暴走约伯的博客 3295

class文件不能反编译

由于不能读取配置中心更新后的数据,排查到***ScheDuleImpl类,通过jd-gui.exe反编译工具打开,报以下错误 通过注释部分代码找到问题根源为 List<Integer> idList = Lists.transform(studentList, student -> student.getId());此处不能使用lambda表达式,采用原始方式反编译OK,原始方式为 List<Int

龙城之家的博客 5940

ROS & ROS2 机器人深度相机激光雷达多传感器标定工具箱入门教程(一)

multisensor_calibration 是一个积极维护的通用标定工具箱,用于辅助基于目标的多传感器标定,支持 ROS 1 和 ROS 2。它提供了多种方法和应用来标定复杂的多传感器系统,例如。

2506_90492529的博客 3263

Truncated class file 问题的解决

Truncated class file 问题的解决 替换class 文件之后出现了Truncated class file 问题,查找原因,可能是文件损坏,清理缓存可以解决 解决办法: 把tomcat的work目录直接删掉, Caused by: javax.servlet.ServletException: java.lang.ClassFormatError: Truncated class file at org.apache.jasper.servlet....

媛猿 4746

yolov8涨点系列之轻量化主干网络替换

yolov8涨点系列之轻量化主干网络替换,以EfficientVit为例

zhang1379的博客 2887

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

kotlin中class和file的区别

kotlin中class和file的区别?如果一个 class 中只有一个 类,该类文件就以 classname命名;但是如果 在该文件中 添加一个 class 文件就变成了 .file

米小豆的博客 4278

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

JDK 24 Class File API 介绍

JDK 24 引入的提供了一套类型安全的 API 用于操作 Java 类文件。这套 API 允许我们以编程方式读取、修改和创建 Java 类文件,而不需要直接处理底层的字节码。注:Class File API的前世今生,参见小子前作《JDK 24正式支持Class-File API。

炎黄的专栏 1490

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Java 23新特性:Class-File API

Class-File API,该特性为第二次预览,在Java 22中首次预览,并将在Java 24中成为正式特性。目前已经存在一些工具可以处理类文件,例如ASM,BCEL,Javassist。该特性不是为了解决效率或代码分析问题,也不是Core Reflection API的扩展。该特性的出现只是为了提供一个标准的类文件处理API,最终把JDK内部的ASM库移除。想象一下这样的场景,一个老的没有源码的项目,现在被要求每个方法执行前后都输出一下日志并记录执行时间。

leonidZhao的博客 730

Java“class file contains wrong class”解决

当Java出现“class file contains wrong class”错误时,通常表示类文件中的内容与预期的类定义不匹配。

bubiyoushang888的博客 375

JDK 24正式支持Class-File API

提供一个用于解析、生成和转换 Java class 文件的标准 API。

炎黄的专栏 199

PHP中的__FILE,__CLASS等魔术变量

今天看到一个魔术变量,是以前没见过的,__DIR__,我查了查,发现原来是php5.3新增的,顺便举几个例子,解释一下php的魔术变量 1,__FILE__ 文件的完整路径和文件名。如果用在被包含文件中,则返回被包含的文件名。自 PHP 4.0.2 起,__FILE__ 总是包含一个绝对路径(如果是符号连接,则是解析后的绝对路径),而在此之前的版本有时会包含一个相对路径。这个变量,我用的是最多...

远去的渡口 222

Unsupported class file major version 61

简介:illegalargumentexception:不支持的类文件主版本61,jdk版本过高。

懒的博客 4万+
上一篇: tree
下一篇: 关于static
raphaelxia
博客等级 码龄22年 6粉丝 112原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值