当前位置: 首页 > news >正文

查看java class文件的字节码

需要用到Oolong工具,使用教程 https://tengqingshan.blog.csdn.net/article/details/115414875


Message.java 源代码文件

public class Message {
	public static void main(String[] args) {
		System.out.println("junshan say:Hello Word!");
	}
}

对其编译成class文件后,执行

java COM.sootNsmoke.oolong.DumpClass Message.class

后输出:


E:\代码\java\深入分析java web技术内幕>java COM.sootNsmoke.oolong.DumpClass Message.class
000000 cafebabe          magic = ca fe ba be
000004 0000              minor version = 0
000006 0034              major version = 52
000008 001d              29 constants
00000a 0a0006000f           1. Methodref class #6 name-and-type #15
00000f 0900100011           2. Fieldref class #16 name-and-type #17
000014 080012               3. String #18
000017 0a00130014           4. Methodref class #19 name-and-type #20
00001c 070015               5. Class name #21
00001f 070016               6. Class name #22
000022 010006               7. UTF length=6
000025 3c696e69743e                       <init>
00002b 010003               8. UTF length=3
00002e 282956                             ()V
000031 010004               9. UTF length=4
000034 436f6465                           Code
000038 01000f               10. UTF length=15
00003b 4c696e654e756d6265725461626c65     LineNumberTable
00004a 010004               11. UTF length=4
00004d 6d61696e                           main
000051 010016               12. UTF length=22
000054 285b4c6a6176612f6c616e672f537472   ([Ljava/lang/Str
000064 696e673b2956                       ing;)V
00006a 01000a               13. UTF length=10
00006d 536f7572636546696c65               SourceFile
000077 01000c               14. UTF length=12
00007a 4d6573736167652e6a617661           Message.java
000086 0c00070008           15. NameAndType name #7 descriptor #8
00008b 070017               16. Class name #23
00008e 0c00180019           17. NameAndType name #24 descriptor #25
000093 010017               18. UTF length=23
000096 6a756e7368616e207361793a48656c6c   junshan say:Hell
0000a6 6f20576f726421                     o Word!
0000ad 07001a               19. Class name #26
0000b0 0c001b001c           20. NameAndType name #27 descriptor #28
0000b5 010007               21. UTF length=7
0000b8 4d657373616765                     Message
0000bf 010010               22. UTF length=16
0000c2 6a6176612f6c616e672f4f626a656374   java/lang/Object
0000d2 010010               23. UTF length=16
0000d5 6a6176612f6c616e672f53797374656d   java/lang/System
0000e5 010003               24. UTF length=3
0000e8 6f7574                             out
0000eb 010015               25. UTF length=21
0000ee 4c6a6176612f696f2f5072696e745374   Ljava/io/PrintSt
0000fe 7265616d3b                         ream;
000103 010013               26. UTF length=19
000106 6a6176612f696f2f5072696e74537472   java/io/PrintStr
000116 65616d                             eam
000119 010007               27. UTF length=7
00011c 7072696e746c6e                     println
000123 010015               28. UTF length=21
000126 284c6a6176612f6c616e672f53747269   (Ljava/lang/Stri
000136 6e673b2956                         ng;)V
00013b 0021              access_flags = 33
00013d 0005              this = #5
00013f 0006              super = #6
000141 0000              0 interfaces
000143 0000              0 fields
000145 0002              2 methods
                         Method 0:
000147 0001                 access flags = 1
000149 0007                 name = #7<<init>>
00014b 0008                 descriptor = #8<()V>
00014d 0001                 1 field/method attributes:
                            field/method attribute 0
00014f 0009                    name = #9<Code>
000151 0000001d                length = 29
000155 0001                    max stack: 1
000157 0001                    max locals: 1
000159 00000005                code length: 5
00015d 2a                      0 aload_0
00015e b70001                  1 invokespecial #1
000161 b1                      4 return
000162 0000                    0 exception table entries:
000164 0001                    1 code attributes:
                               code attribute 0:
000166 000a                       name = #10<LineNumberTable>
000168 00000006                   length = 6
                                  Line number table:
00016c 0001                       length = 1
00016e 00000001                      start pc: 0 line number: 1
                         Method 1:
000172 0009                 access flags = 9
000174 000b                 name = #11<main>
000176 000c                 descriptor = #12<([Ljava/lang/String;)V>
000178 0001                 1 field/method attributes:
                            field/method attribute 0
00017a 0009                    name = #9<Code>
00017c 00000025                length = 37
000180 0002                    max stack: 2
000182 0001                    max locals: 1
000184 00000009                code length: 9
000188 b20002                  0 getstatic #2
00018b 1203                    3 ldc #3
00018d b60004                  5 invokevirtual #4
000190 b1                      8 return
000191 0000                    0 exception table entries:
000193 0001                    1 code attributes:
                               code attribute 0:
000195 000a                       name = #10<LineNumberTable>
000197 0000000a                   length = 10
                                  Line number table:
00019b 0002                       length = 2
00019d 00000003                      start pc: 0 line number: 3
0001a1 00080004                      start pc: 8 line number: 4
0001a5 0001              1 classfile attributes
                         Attribute 0:
0001a7 000d                 name = #13<SourceFile>
0001a9 00000002             length = 2
0001ad 000e                 sourcefile index = #14
Done.

相关文章:

  • springMVC使用return redirect 而不是 return viewName的作用
  • mac meta键是什么
  • redis列表列出所有
  • sismember缩写
  • scard缩写
  • zrevrange缩写
  • 农业银行查询开户支行的方法
  • 深入剖析Tomcat 中英文 文字pdf+源代码
  • 正则表达式 匹配32位字符
  • 谷歌浏览器安装代理插件后Fiddler无法监听到
  • 只能采用某个特定的被适配类 解释
  • Shenandoah收集器三个并发阶段工作过程图
  • 易语言显示js时间格式
  • Cannot resolve MVC view
  • ZooKeeper安装和配置 for Mac
  • [译] 怎样写一个基础的编译器
  • __proto__ 和 prototype的关系
  • Android开源项目规范总结
  • C++类的相互关联
  • Elasticsearch 参考指南(升级前重新索引)
  • Java的Interrupt与线程中断
  • Js基础知识(一) - 变量
  • nodejs实现webservice问题总结
  • Promise面试题2实现异步串行执行
  • React-Native - 收藏集 - 掘金
  • Spring Cloud中负载均衡器概览
  • Webpack 4 学习01(基础配置)
  • 从@property说起(二)当我们写下@property (nonatomic, weak) id obj时,我们究竟写了什么...
  • 基于组件的设计工作流与界面抽象
  • 记一次和乔布斯合作最难忘的经历
  • 一起来学SpringBoot | 第三篇:SpringBoot日志配置
  • 一些基于React、Vue、Node.js、MongoDB技术栈的实践项目
  • 云栖大讲堂Java基础入门(三)- 阿里巴巴Java开发手册介绍
  • 怎么把视频里的音乐提取出来
  • AI又要和人类“对打”,Deepmind宣布《星战Ⅱ》即将开始 ...
  • Hibernate主键生成策略及选择
  • ​【已解决】npm install​卡主不动的情况
  • (13)Hive调优——动态分区导致的小文件问题
  • (3)STL算法之搜索
  • (C++20) consteval立即函数
  • (delphi11最新学习资料) Object Pascal 学习笔记---第2章第五节(日期和时间)
  • (function(){})()的分步解析
  • (八)Docker网络跨主机通讯vxlan和vlan
  • (待修改)PyG安装步骤
  • (读书笔记)Javascript高级程序设计---ECMAScript基础
  • (附源码)ssm教材管理系统 毕业设计 011229
  • (南京观海微电子)——I3C协议介绍
  • (七)Knockout 创建自定义绑定
  • (五)c52学习之旅-静态数码管
  • (一)spring cloud微服务分布式云架构 - Spring Cloud简介
  • (转)iOS字体
  • (转)创业家杂志:UCWEB天使第一步
  • .bat批处理(三):变量声明、设置、拼接、截取
  • .NET 8.0 发布到 IIS
  • .net core webapi Startup 注入ConfigurePrimaryHttpMessageHandler