Not stopping at eclipse debug point

时间:2017-04-06 16:48:14

标签: java eclipse


I am new to java,i have setup eclipse java project.I have a set of classes in jars in a folder.I have also got the java files associated to those classes downloaded (i cant compile those java files,its just to read and debug at runtime).My issue is class files are packaged in a different way than the those what appears in java file. eg:- ABC.java is structured as platform\src\main\java\com\subplatform\sql\ABC.java

But package declared in java file if i open is com.subplatform.sql;

I think this is the reason the debug point is not getting honored.In the previous version's of this product

java files used to be structured as src\com\subplatform\sql\ABC.java

Thus it used to stop at the debug point.

Thanks

2 个答案:

答案 0 :(得分:0)

Rename all the package information that contains package com.[restOfPackageInfo] to be package java.com.[restOfPackageInfo] and you should be all set. (Also, if there are any import statements, you'll need to add java in front of com there too.)

There's your problem:

Originally the file structure was "src\com\subplatform\sql\ABC.java"

But by creating a folder called java and placing the com folder inside, you're changing the path to be: "src\main\java\com\subplatform\sql\ABC.java"

So, essentially in the ABC file you see package com.subplatform.sql;. This is information that the compiler uses to compile the class. So you're compiler looks for a ABC.java in src with path com.subplatform.sql but there is no such folder.

Also, read up on packaging.

答案 1 :(得分:0)

听起来您的源附件路径错误,应该指向platform\src\main\java\而不是项目本身。

不受尊重的调试点可能意味着两件事。

1)调试器不在线路断点上停止。如果编译的类文件没有行和调试信息,则JVM不知道它何时执行这些行并且不会在那里停止。您应该仍然可以在方法条目和停止异常时停止。无论哪种方式,总是需要使用Debug而不是Run来启动应用程序。

2)调试器正在停止,但未找到源。对于JAR文件,您应该让Java Build Path上JAR条目的属性指向源文件完全与jar布局匹配的位置,以便{{1相对于源附件指向的位置有com/novice/to/sql/MyClass.class。如果JAR文件的顶级内容包含" com"," org"和" net"等条目,那么应该在您指向的源目录或存档的顶级。