【问题标题】:Source not found when debugging all projects调试所有项目时找不到源
【发布时间】:2013-10-23 16:43:28
【问题描述】:

我知道很多人在这里发布了这个问题,我尝试了他们的解决方案,但无法成功。 每当我按 f5 时,我调试的所有项目都会得到这个“找不到源”。我刚刚创建了一个简单的应用程序,例如: System.out.println("测试"); 它运行,但是当我调试“找不到源”时总是出现。我是新手。我不知道该怎么做。 这是堆栈跟踪:

Class<T>.getDeclaredMethods0(boolean) line: not available [native method
Class<T>.privateGetDeclaredMethods(boolean) line: not available
Class<T>.getMethod0(String, Class<?>[]) line: not available
Class<T>.getMethod(String, Class<?>...) line: not available
LauncherHelper.getMainMethod(PrintStream, Class<?>) line: not available
LauncherHelper.checkAndLoadMain(boolean, int, String) line: not available
C:\Program Files\Java\jre7\bin\javaw.exe (Oct 24, 2013 12:22:07 AM)
sample.java Class<T>.getDeclaredMethods0(boolean) line: not available [native method] Outline
Source not found. An outline is not available

提前致谢。

【问题讨论】:

    标签: eclipse debugging


    【解决方案1】:

    确实来源不可用。您正在使用 JRE 运行程序,它是编译后的代码。

    你有两个选择

    1. 在调试期间下载源代码并将其附加到 jar 中。 Attach the Source in Eclipse of a jar
    2. 使用 JAD 自动反编译类文件。 http://www.mkyong.com/java/java-decompiler-plugin-for-eclipse/

    【讨论】:

    • 如果我更改路径使其无法在 jre 上运行怎么办?它会起作用吗?我可以这样做吗?
    • 如果没有 JRE,您将无法运行 java 程序。为什么要看System.out.println的代码。 println 方法内部使用本机代码(用 c 编写的代码)写入控制台。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-04
    • 2011-12-15
    • 1970-01-01
    • 2021-11-12
    • 2013-06-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多