问题描述:

I´m really confused, i´m making a small GUI for UI Automation at Work, works perfectly in Netbeans IDE 8.0, no running problems at all!

But i haven't tried to run the executable jar before and there lies the problem…it isn´t running. The JAR starts, but nothing comes up ???

So i tried du run it via terminal an there is a really long Exception:

Anyone an idea ?

网友答案:

The main cause for a NPE in a jar on the same computer as opposed to a working set of java .class files:

  1. Using a File instead of getResource/getResourceAsStream - a File cannot look in a jar.
  2. Using a different letter case, as Windows is case-insensitive, but a jar (zip) not (also not Linux/MacOSX).
  3. Class path was more relaxed (+src) and the resource file did not get copied into the jar.

So do a clean build, look into the jar with WinZip/7zip/NetBeans.

Check for suspicious sweeps-under-the-carpet: catch (Exception e) { }.

Finally one could look at the error too: the source, and what is done specially with the JList (some component?). The stack trace shows that it is during the layouting of the JList. Is it a simple JList<String>?

相关阅读:
Top