Java Web Start 应用程序反复询问不存在的文件 [英] Java Web Start applications ask repeatedly for un-existing files

查看:22
本文介绍了Java Web Start 应用程序反复询问不存在的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 NetBeans 制作的所有应用程序作为 Java Web Start 应用程序的行为都非常奇怪.当我将它们作为普通应用程序运行时,一切正常.

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.

但是当我将它们编译为 java web start 应用程序时,它们在加载完 java web start 之后,反复向服务器询问错误位置的库.这在小型项目中似乎并不重要,但在大型项目中会产生巨大的时间差异(请参阅我的第一个问题).

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).

我在这里放了一个简单的 NetBeans 项目.它应该用一个什么都不做的按钮来绘制一个窗口.(如果你想把它放在某个地方,上传dist文件夹并编辑.jnlp文件)

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)

您可以从日志(在logs.txt 中)看到,首先从/awindow_dist/lib/ 很好地下载了库,但是随后有很多请求到错误的地方,<代码>/awindow_dist/.有什么问题?一切似乎都配置得很好.

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.

这是 NetBeans 错误吗?WebStart 错误?还是我的错?

Is it a NetBeans bug? A WebStart bug? Or my fault somehow?

推荐答案

好吧,这肯定是 NetBeans 的一个 bug,很有可能是 NB 生成的 build.xml 文件.

OK, it is definitely a bug in NetBeans, very probably in the build.xml file generated by NB.

我有点迷失在巨大的 build.xml 和 build-impl.xml 以及 jnlp-impl.xml 中,但是我让 Java Web Start 在 NetBeans 中工作的肮脏解决方法是:

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:

  1. 将生成的 JNLP 复制到某处,因为它很好
  2. 关闭关闭 NetBeans 项目中的 JWS
  3. 不要让 NetBeans 对 .jar 文件进行签名,而是像这样编写一些 shell 脚本

  1. copy the generated JNLP somewhere, because it is fine
  2. turn off the JWS in the NetBeans project
  3. instead of letting NetBeans to sign the .jar files, writing some shell script like this

ant clean
ant jar 
#because these two works fine

for i in `ls dist/*.jar; ls dist/lib/*.jar`
do
   jarsigner -storepass mystorepass -keypass mykeypass $i myname
   #sign all the .jars
done

cp launch.jnlp dist/launch.jnlp 
#copy the .jnlp

  • 使脚本成为 build.xml 中的目标,例如 这个

    完成.这是一个肮脏的黑客,只适用于 bash,因为我真的不知道 ant 是如何工作的 + 由 netbeans 生成的构建文件非常复杂.但它完成了工作.

    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.

    这篇关于Java Web Start 应用程序反复询问不存在的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆