无法在Java中的一个函数中打破断点 [英] Unable to hit a break point inside a function in Java

查看:338
本文介绍了无法在Java中的一个函数中打破断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用maven构建在远程服务器上运行我的eclipse项目。我在一些java文件中设置了几个断点来检查代码的控制流程。我无法到达功能实现块内的断点。我在java文件中有两个断点,如下所示:

 。)public List< classType> functionName(args)throws someException {

。)System.out.println(你应该在这里停止);

//尝试{
//一些更多代码}
// catch {}

}

两个。)表示我设置的断点。系统在第一个停止,但不在第二个停止。我真的不明白我在这里失踪了什么看起来系统到达块,并且还执行所需的功能,但是不会在断点停止。



PS:通过给出mvn install命令,在命令提示符下执行项目,并打开调试模式查找流程。

解决方案

通常,无法点击远程断点意味着远程系统上的编译代码与您在Eclipse会话中看到的源代码。断点由行号设置,如果行号不匹配,则断点可能指向远程系统上不可执行的行号(即不是断点的候选)。在这种情况下,断点不会被设置,并且似乎被跳过。



您必须确保远程上运行的代码是与您完全相同的源编译的在您当地的Eclipse中看到。


I am running my eclipse project in a remote server using maven build. I have set a couple of break points in some of the java files to check the control flow of the code. I am unable to reach the break point inside a function implementation block. I have two break points in a java file like the one shown below:

.) public List<classType> functionName(args) throws someException{

.) System.out.println("You should stop here");

//try{
//some more code}
//catch{}

} 

The two .) represents the break points I have set. The system stops at the first one but not at the second. I don't really understand what I am missing here. Looks like the system reaches the block and also performs the desired function, but just does not stop at the break point.

PS: I execute the project in command prompt by giving mvn install command and turn on the debug mode to look for the flow.

解决方案

Usually, failure to hit a remote breakpoint means that the compiled code on the remote system is not exactly the same version as the source code you are seeing in your Eclipse session. Breakpoints are set by line number and if the line numbers don't match the breakpoint could point to a line number that is not executable (i.e. not a candidate for a breakpoint) on the remote system. In that case the breakpoint would not be set and would appear to be skipped.

You must ensure that the code running on the remote was compiled from exactly the same source as you are seeing in your local Eclipse.

这篇关于无法在Java中的一个函数中打破断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆