【问题标题】:How to get java to ignore an error while running?如何让java在运行时忽略错误?
【发布时间】:2015-06-26 06:12:22
【问题描述】:

我的 java 程序在 Eclipse 中完美运行(只是输出错误),但是当我尝试导出它并将其作为 jar 运行时,它会因为错误而停止。如何让 java 忽略该错误?

这是我遇到的错误:

ERROR StatusLogger Unable to locate a logging implementation, using SimpleLogger

FATAL Launcher Unhandled exception in thread Thread[main,5,main] java.lang.refle
ct.InvocationTargetException
    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.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
 Caused by: java.lang.IllegalArgumentException: input == null!
    at javax.imageio.ImageIO.read(Unknown Source)
    at net.minecraft.launcher.ui.TexturedPanel.<init>(TexturedPanel.java:23)

    at net.minecraft.launcher.ui.LauncherPanel.<init>(LauncherPanel.java:36)

    at net.minecraft.launcher.SwingUserInterface.initializeFrame(SwingUserIn
terface.java:108)
    at net.minecraft.launcher.Launcher.<init>(Launcher.java:91)
    at net.minecraft.launcher.Main.main(Main.java:56)
    ... 5 more

【问题讨论】:

  • 尝试{}catch(Exception){},但请注意,错误是有意义的
  • 看到这个...stackoverflow.com/questions/7590275/….. 可能会有所帮助
  • 请显示错误信息。
  • @Danielson 我没有创建错误的类,它已经编译,所以我无法轻松编辑它
  • 然后是更多信息... 有什么东西被抛出了吗?你怎么称呼它?

标签: java eclipse compiler-errors


【解决方案1】:

使用 try catch 方法 try{ } catch(Exception)

这也是一个有用的链接https://docs.oracle.com/javase/tutorial/essential/exceptions/try.html

【讨论】:

    猜你喜欢
    • 2010-12-21
    • 1970-01-01
    • 2018-12-12
    • 2012-07-17
    • 2018-02-06
    • 2015-08-22
    • 1970-01-01
    • 2018-07-15
    • 1970-01-01
    相关资源
    最近更新 更多