简体   繁体   English

在Netbeans 8.0中运行但未以JAR形式运行的项目

[英]Project running in Netbeans 8.0 but not as JAR

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! 我真的很困惑,我正在为工作中的UI自动化制作一个小型GUI,可以在Netbeans IDE 8.0中完美运行,根本没有运行问题! But i haven't tried to run the executable jar before and there lies the problem…it isn´t running. 但是我之前没有尝试过运行可执行jar,这就是问题所在……它没有运行。 The JAR starts, but nothing comes up ??? JAR开始,但是什么都没有发生? 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: 与同一套Java .class文件的工作集不同,同一计算机上的jar中存在NPE的主要原因是:

  1. Using a File instead of getResource/getResourceAsStream - a File cannot look in a jar. 使用File而不是getResource/getResourceAsStream文件无法在jar中查找。
  2. Using a different letter case, as Windows is case-insensitive, but a jar (zip) not (also not Linux/MacOSX). 由于Windows不区分大小写,因此使用不同的字母大小写,但是不区分大小写(zip)(也不是Linux / MacOSX)。
  3. Class path was more relaxed (+src) and the resource file did not get copied into the jar. 类路径更加宽松(+ src),并且资源文件未复制到jar中。

So do a clean build, look into the jar with WinZip/7zip/NetBeans. 因此,进行干净的构建,使用WinZip / 7zip / NetBeans查看jar。

Check for suspicious sweeps-under-the-carpet: catch (Exception e) { } . 检查地毯下是否有可打扫物: catch (Exception e) { }

Finally one could look at the error too: the source, and what is done specially with the JList (some component?). 最后,我们也可以看看错误:源代码,以及使用JList(某些组件?)专门进行的操作。 The stack trace shows that it is during the layouting of the JList. 堆栈跟踪显示它在JList的布局期间。 Is it a simple JList<String> ? 它是一个简单的JList<String>吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM