编译器在构建路径之外运行类,而不是在构建路径内运行类

发布于 2024-12-08 11:01:48 字数 1538 浏览 0 评论 0原文

我正在开发一个使用一系列并行项目的java应用程序。在其中一个项目中,我有一个类是接口的实现。我遇到的一个问题是,这个类似乎以两种方式表示,既作为构建路径中的类,又作为构建路径外的类。

在 Eclipse 中,我可以将类作为选项卡打开,其中包含两个“路径版本”,一个带有“填充 J”,一个带有“空心 J”。这对我来说不是问题,我不在乎,问题是编译器似乎总是将类作为“不是构建路径的一部分”版本运行。当我调试时,调试器总是最终出现在构建路径之外的类中。这会导致错误和应用程序崩溃。

我不知道应该如何解决它。根据我的理解,这甚至不应该是一个问题,编译器应该始终在构建路径内运行类,对吧..?

有谁知道问题可能是什么?

这是堆栈跟踪,尽管我认为它没有多大用处...=\

Caused by: java.lang.NullPointerException: null
    at com.smarttrust.m2m.core.services.inventory.InventoryServiceImpl.getNetworks(InventoryServiceImpl.java:244) ~[m2m-core-services-1.0.0-A-SNAPSHOT.jar:1.0.0-A-SNAPSHOT]
    at com.smarttrust.m2m.ui.admin.inventory.InventoryAssignSubscription.populateDropdown(InventoryAssignSubscription.java:211) ~[classes/:na]
    at com.smarttrust.m2m.ui.admin.inventory.InventoryAssignSubscription.init(InventoryAssignSubscription.java:115) ~[classes/:na]
    at com.smarttrust.m2m.ui.admin.inventory.InventorySimCardTable$ActionColumnGenerator$1.buttonClick(InventorySimCardTable.java:352) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_26]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_26]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_26]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_26]
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490) ~[vaadin-6.6.3.jar:6.6.3]
    ... 23 common frames omitted

I'm developing a java application that uses a range a parallel projects. In one of the projects I have a class that is the implementation of an interface. A problem I'm having though is that this class seems to be represented in two ways, both as a class in the build path and as a class outside the build path.

In Eclipse I can have the class open as a tab with both "path-versions", one with a "filled in J" and one with a "hollow J". This isn't a problem for me, I don't care about that, the thing is though that the compiler always seem to run the class as the "not-being-part-of-the-build-path"-version. When I debug the debugger always ends up in the class outside the build path. This causes errors and the application crashes.

I have no idea how I should solve it. In my understanding this shouldn't even be a problem, the compiler should always run classes inside the build path, right..?

Does anyone have any idea of what the problem might be?

Here's the stack trace, though I don't think it will be of much use... =\

Caused by: java.lang.NullPointerException: null
    at com.smarttrust.m2m.core.services.inventory.InventoryServiceImpl.getNetworks(InventoryServiceImpl.java:244) ~[m2m-core-services-1.0.0-A-SNAPSHOT.jar:1.0.0-A-SNAPSHOT]
    at com.smarttrust.m2m.ui.admin.inventory.InventoryAssignSubscription.populateDropdown(InventoryAssignSubscription.java:211) ~[classes/:na]
    at com.smarttrust.m2m.ui.admin.inventory.InventoryAssignSubscription.init(InventoryAssignSubscription.java:115) ~[classes/:na]
    at com.smarttrust.m2m.ui.admin.inventory.InventorySimCardTable$ActionColumnGenerator$1.buttonClick(InventorySimCardTable.java:352) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_26]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_26]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_26]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_26]
    at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490) ~[vaadin-6.6.3.jar:6.6.3]
    ... 23 common frames omitted

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦罢 2024-12-15 11:01:48

转到Order and Export 选项卡中的项目构建路径。
您看到与您的项目相关的所有源代码,您应该向上移动正确的类(正如您所说的构建路径中的类)

Go to project build path, in Order and Export tab.
you see all source codes which is related to your project, You should move up the class that is right (as you say the one which is in build path)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文