javap -l 选项无法显示行号信息
javap
命令有几个选项,其中之一是-l
,它可以打印行号和局部变量表。假设一个java程序已经编译成功,并且有“Main.class”文件,那么运行javap -l Main 会产生类似这样的结果:
public static void main(java.lang.String[]);
LineNumberTable:
line 100: 0
line 101: 27
line 275: 54
LocalVariableTable:
Start Length Slot Name Signature
0 55 0 args [Ljava/lang/String;
但是,我正在使用这个javap -l xxx命令在一个java程序的类文件中,但行号和局部变量表区域为空(这是不应该的)。 javap
命令和其他选项如 -s
、-verbose
工作正常,但只有与 - 对应的行信息区域l
选项为空。
有谁遇到过这种奇怪的情况吗?
The javap
command has several options, one of them is -l
, which can print line number and local variable tables. Suppose a java program has been compiled successfully and there is the file "Main.class", so running javap -l Main
can produce something like:
public static void main(java.lang.String[]);
LineNumberTable:
line 100: 0
line 101: 27
line 275: 54
LocalVariableTable:
Start Length Slot Name Signature
0 55 0 args [Ljava/lang/String;
However, I'm using this javap -l xxx
command on the class files of one java program, but the area of line number and local variable table is empty (which shouldn't be). The javap
command and other options such as -s
, -verbose
works fine, but only the line info area corresponding to the -l
option is empty.
Has anyone ever encountered such weird case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 -g 编译代码,否则不会保留行号(类似于显示“已编译代码”而不是行号的堆栈跟踪)
Use -g to compile your code, otherwise the line numbers are not kept (akin to the stack trace displaying "compiled code" instead of the line number)