行号作为debug信息

在出现异常时可以迅速定位

package ztest;

public class Test {
public static void main(String[] args) {
int a = 1/1;
int b = 1/2;
int c = 1/3;
int d = 1/4;
int e = 1/0;
int f = 1/6;
int g = 1/7;
}
}
Exception in thread "main" java.lang.ArithmeticException: / by zero
at ztest.Test.main(Test.java:9)

 解读 

  • 异常信息出现在 "main" 线程
  • 位置是 ztest.Test (类的全限定名 )的 main (方法)(Test.java 文件的第9行)

反编译后的class是:

这里的行号是指 java 源文件中的行号 Ctrl+L 可打开

增加/删除任何行,包括空行注释等,都会影响行号

package ztest;

public class Test {
public static void main(String[] args) {
int a = 1/1;
int b = 1/2;
int c = 1/3;
int d = 1/4;
int e = 1/0;
int f = 1/6;
int g = 1/7;
}
}
Exception in thread "main" java.lang.ArithmeticException: / by zero
at ztest.Test.main(Test.java:13)

line number is important in Exceptions.的更多相关文章

  1. Eclipse "Unable to install breakpoint due to missing line number attributes..."

    Eclipse 无法找到 该 断点,原因是编译时,字节码改变了,导致eclipse无法读取对应的行了 1.ANT编译的class Eclipse不认,因为eclipse也会编译class.怎么让它们统 ...

  2. 无法debug断点跟踪JDK源代码——missing line number attributes的解决方法

    在项目工程->Properties->Java Build Path->Libraries中导入的JRE System Library库里,给jar包添加JDK源代码包后,能够直接打 ...

  3. IDEA Show Line Number

    刚开始用IDEA,经常发现右侧没有显示行号,然后去右键选一下,就显现了 一直没有留意这个现象,刚用vim想删几行数据代码,突然发现没有行号了 明明记得刚刚才右键显示了的 好吧,有行号用着比较顺心了.. ...

  4. Eclipse-debug时提示absent line number information的解决办法

    unable to install breakpoint in ...(file name) due to miss line number attributes. midify compliter ...

  5. Unable to perform unmarshalling at line number 16 and column 63 in RESOURCE hibernate.cfg.xml. Message: cvc-elt.1: 找不到元素 'hibernate-configuration' 的声明。

    七月 02, 2017 4:32:37 下午 org.hibernate.Version logVersionINFO: HHH000412: Hibernate Core {5.2.10.Final ...

  6. MyEclipse 断点打不上 提示 absent line number information

    在加入断点时,提示出 unable to install breakpoint in ...(file name) due to miss line number attributes. midify ...

  7. eclipse报错:unable to install breakpoint in .......due to missing line number attributes

    报错信息如下: 解决方案方案1.把断点都干掉,再启动.应该是代码更新后,断点位置没有代码了或位置改变了. 方案2.在Eclipse - Preferences - Java - Complier 下  ...

  8. gdb 调试 报 stepping until--- has no line number information

    gdb 经常用 ,但今天使用gdb 调试的时候, break 打断点, 结果也没有打出 哪一行的信息,就只是提示一个具体地址. 使用单步调试 结果爆出 stepping until exit from ...

  9. javax.script.ScriptException: ReferenceError: "window" is not defined in security.js at line number 10

    使用jmeter执行加密登录接口的测试遇到的问题. 问题记录: 今天使用jmeter执行加密登录接口的测试,因为测试环境的应用包是以前的老版本(可能有两年了),所以需要替换加密文件:security. ...

随机推荐

  1. 【Linux】【Jenkins】邮件发送失败的问题javax.mail.MessagingException: Could not connect to SMTP host:

    javax.mail.MessagingException: Could not connect to SMTP host: smtp.126.com,port:25 解决方案: 之前用的是126邮箱 ...

  2. 关于java字节码框架ASM的学习

      一.什么是ASM ASM是一个java字节码操纵框架,它能被用来动态生成类或者增强既有类的功能.ASM 可以直接产生二进制 class 文件,也可以在类被加载入 Java 虚拟机之前动态改变类行为 ...

  3. git 第一次提交代码

    git init git add README.md git commit -m "first commit" git remote add origin https://git. ...

  4. kettle 常用组件

    Dummy步骤不会做任何事情.它的主要功能是作为以测试为目的的占位符. 追加流 分析查询(前后行查询),步骤:增加常量数据包括id,name连个字段,增加自增列autoid字段,按id,outid进行 ...

  5. leetcode4

    public class Solution { public double FindMedianSortedArrays(int[] nums1, int[] nums2) { var nums = ...

  6. xtrabackup备份还原MySQL数据库

    mysqldump 备份鉴于其自身的某些特性(锁表,本质上备份出来insert脚本或者文本,不支持差异备份),不太适合对实时性要求比较高的情况Xtrabackup可以解决mysqldump存在的上述的 ...

  7. OpenCV常用数据类型

    Point 二维点坐标(x,y) typedef Point3_<int> Point3i; typedef Point3_<float> Point3f; typedef P ...

  8. UGUI中Text的换行

    通过代码中的\n可以直接执行换行效果,但是我们在平常的工作中一般都是读表,既在Inspector面板中的Text组件中输入同样的内容就达不到换行效果: 其实unity把\n转变成了\\n,我们只需要变 ...

  9. HDU-1260.Tickets(简单线性DP)

    本题大意:排队排票,每个人只能自己单独购买或者和后面的人一起购买,给出k个人单独购买和合买所花费的时间,让你计算出k个人总共花费的时间,然后再稍作处理就可得到答案,具体格式看题意. 本题思路:简单dp ...

  10. 10. Regular Expression Matching (JAVA)

    Given an input string (s) and a pattern (p), implement regular expression matching with support for ...