Java Web Start应用程序反复询问不存在的文件 [英] Java Web Start applications ask repeatedly for un-existing files
问题描述
我使用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应用程序时,在完成加载后,它们会反复向服务器询问错误位置的库.在小型项目中似乎无关紧要,但是在大型项目中却有很大的时间差异(请参阅我的第一个问题).
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中的错误,很可能是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:
- 将生成的JNLP复制到某个地方,因为它很好
- 关闭关闭 NetBeans项目中的JWS
-
而不是让NetBeans签名.jar文件,而是编写一些这样的shell脚本
- copy the generated JNLP somewhere, because it is fine
- turn off the JWS in the NetBeans project
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屋!