更新时间:2023-11-19 11:12:37
这通常与缺少调试信息有关.您可能正在使用 JRE(不是 JDK),它不包含 rt.jar 类的调试信息.尝试使用完整的 JDK,您将在堆栈跟踪中获得正确的位置:
This is normally related to missing debug information. You are probably using JRE (not JDK), which does not include debug information for rt.jar classes. Try using full JDK, you'll get proper locations in the stack trace:
Exception in thread "main" java.lang.NullPointerException
at java.lang.String.<init>(String.java:177)
at java.lang.String.valueOf(String.java:2840)
at StringValueOfNull.main(StringValueOfNull.java:3)