Java Web Start 应用程序反复询问不存在的文件
我使用 NetBeans 创建的所有应用程序作为 Java Web Start 应用程序的行为都非常奇怪。当我将它们作为普通应用程序运行时,一切正常。
但是,当我将它们编译为 java web start 应用程序时,它们在 java web start 完成加载后,反复向服务器请求错误位置的库。在小型项目中这似乎并不重要,但在大型项目中却会产生巨大的时间差异(请参阅我的第一个问题)。
我在此处放置了一个简单的 NetBeans 项目。它应该用一个不执行任何操作的按钮绘制一个窗口。 (如果您尝试将其放在某个地方,请将 dist
文件夹上传到某个位置并编辑 .jnlp
文件)
您可以从日志(在logs.txt中)看到该库首先从 /awindow_dist/lib/
下载得很好,但随后有很多请求发送到错误的位置 /awindow_dist/
。有什么问题吗?一切似乎都配置得很好。
这是 NetBeans 的错误吗? WebStart 错误?还是我的错?
All my application I make with NetBeans as a Java Web Start applications behave quite strangely. When I run them as a normal application, everything works.
But when I compile them as java web start apps, they, after the java web start is done with loading, repeatedly ask server for libraries on the wrong place. It doesn't seem to matter in small projects, but it makes a huge time difference in large projects (see my first question).
I put a simple NetBeans project here. It should paint a window with a button that does nothing at all. (if you try to put it somewhere, upload the dist
folder somewhere and edit the .jnlp
file)
You can see from the logs (in logs.txt) that the libs are first downloaded fine from /awindow_dist/lib/
, but then there comes a lot of requests to the wrong place, /awindow_dist/
. What can be wrong? Everything seems to be configured fine.
Is it a NetBeans bug? A WebStart bug? Or my fault somehow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,这肯定是 NetBeans 中的一个错误,很可能是在 NB 生成的 build.xml 文件中。
我有点迷失在巨大的 build.xml 和 build-impl.xml 和 jnlp-impl.xml 中,但是我的 Java Web Start 在 NetBeans 中工作的肮脏解决方法是:
不要让 NetBeans 签署 .jar 文件,而是编写一些像这样的 shell 脚本
使脚本成为 build.xml 中的目标,如 此
完成。这是一个肮脏的黑客行为,仅适用于 bash,因为我真的不知道 ant 是如何工作的 + 由 netbeans 生成的构建文件非常复杂。但它可以完成工作。
OK, it is definitely a bug in NetBeans, very probably in the build.xml file generated by NB.
I am kind of lost in the giant build.xml and build-impl.xml and jnlp-impl.xml, but my dirty workaround for Java Web Start to work in NetBeans is:
instead of letting NetBeans to sign the .jar files, writing some shell script like this
make the script a target in the build.xml like this
Done. It's a dirty hack and works only with bash, because I don't really know how ant works + the build files, generated by netbeans, are really complicated. But it gets the work done.