如何让java在运行时忽略错误?

时间:2015-06-26 06:12:23

标签: java eclipse compiler-errors

我的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

1 个答案:

答案 0 :(得分:1)

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

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