JavaFX加载外部资源问题
我在 Netbeans 6.8 IDE 中编写了小型 JavaFX Applet。如果小程序在我的计算机上运行,则一切正常。但是,当我将小程序(并编辑包含更改的服务器路径的 JNLP 文件)放入服务器时,它不会从服务器文本文件加载任何数据。路径是正确的 - 我看了很多次 - 没问题。它也不会加载具有外部 URL 的图像。怎么了?
I've coded small JavaFX Applet in Netbeans 6.8 IDE. Everything works fine if the applet runs on my computer. But when I put the applet (and edited JNLP files containing changed paths to server) into server, it doesn't load any data from an server text file. Paths are correct - i look at it many times - they are ok. It also doesn't load images with external urls. What is wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有看到你的代码,所以我会猜测。如果您的资源未捆绑在 JAR 文件中并且您使用 file:// 来访问它,那么您将需要对您的小程序进行签名。在 NetBeans 上,右键单击项目节点 ->属性->应用。选择自签名。
如果您不想签署您的小程序,请以 REST 方式访问您的资源。使用 HttpRequest。
如果它在客户端计算机上,请考虑使用 JNLP API,如下所示。
诊断问题的最佳方法是打开Java控制台并查看是否有任何异常。运行 $JAVA_HOME/bin/ControlPanel ->高级-> Java 控制台 ->显示控制台
Haven't seen your code so I'm going to make a guess. If your resource is not bundled in your JAR file and you are using file:// to access it, then you will need to sign your applet. On NetBeans, right click on project node -> properties -> application. Select self signed.
If you don't want to sign your applet, then access your resource as REST. Use the HttpRequest.
If it is on the client machine, consider using JNLP APIs like so.
The best way to diagnose the problem is to open the Java Console and see if there are any exceptions. Run $JAVA_HOME/bin/ControlPanel -> Advanced -> Java Console -> Show Console