我有一个非常烦人的问题,当在eclipse中从我的源代码中导出jar文件时,我在stacktrace中不会得到有关发生错误的源代码和行号的任何信息。我已经在ecplise中检查了该项目的编译器设置,并且设置了classfile文件生成部分中的所有选项。
我正在开发由服务器软件bukkit执行的Minecraft插件。我的来源在软件包de.celestialcraft.agentestate中。发生异常时,我会得到这样的堆栈跟踪:

23:43:57 [INFO] com.sk89q.worldedit.CuboidClipboard@fb44f99
23:43:57 [SEVERE] Could not pass event BlockDamageEvent to AgentEstate v2.1alpha

org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:363)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
a:62)
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
ava:477)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
ava:462)
    at de.celestialcraft.AgentEstate.AgentEstateBlockListener.onBlockBreak(U
nknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:361)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
a:62)
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
ava:477)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
ava:462)
    at ir.b(ItemInWorldManager.java:393)
    at ir.a(ItemInWorldManager.java:200)
    at iv.a(NetServerHandler.java:782)
    at ei.a(Packet14BlockDig.java:67)
    at cg.b(TcpConnection.java:467)
    at iv.d(NetServerHandler.java:220)
    at iw.b(NetworkListenThread.java:57)
    at ht.b(DedicatedServerListenThread.java:34)
    at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:981)
    at ho.r(DedicatedServer.java:309)
    at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:857)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:744)
    at fy.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
    at com.sk89q.worldedit.schematic.MCEditSchematicFormat.save(Unknown Sour
ce)
    at de.celestialcraft.AgentEstate.Estate.saveState(Unknown Source)
    at de.celestialcraft.AgentEstate.Estate.create(Unknown Source)
    at de.celestialcraft.AgentEstate.Estate.create(Unknown Source)
    at de.celestialcraft.AgentEstate.AgentEstateBlockListener.onBlockDamage(
Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:361)
    ... 25 more

我已经在构建路径设置中将jdk路径设置为项目的lib。希望您能帮我解决这个问题。
谢谢你。

最佳答案

应该标记您的项目以启用特定于项目的设置,并且在Java Compiler-> Classfile generation上,应未标记选项Add line number...。

关于java - Stacktrace Java Eclipse中的未知源,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16003525/

10-14 04:23