我在 netbeans 中的 java web start 小程序有问题。我无法从运行它的地方(即服务器)获得需要由小程序访问的文件和图像的路径。基本上我在本地机器上使用图像来显示文件夹和 pdf 文件的图标,当我在非 Web 上下文中运行小程序时,这一切都很好,但是尝试在服务器意义上使用它会导致失败。
这是导致问题的代码:
company.readCompanyFile("C:\\Users\\Chris\\Desktop\\ArFile Clients\\" + companyName + "\\"
+ companyName + ".cmp");
这只是一个简单的缓冲读取器,试图读取存储在此位置的文件。这些目录应该嵌套在程序根目录中的问题是:
C:\Users\Chris\Documents\NetBeansProjects\ArFile
一个反映我上面给出的信息的例子会很棒
编辑:这是Applet给出的错误消息
BadFieldException[ The field <extension>href has an invalid value: C:\Users\Chris\Desktop\ArFile Clients,C:\Users\Chris\Desktop\ArFile Clients]
at com.sun.javaws.jnl.XMLUtils.getAttributeURL(Unknown Source)
at com.sun.javaws.jnl.XMLUtils.getRequiredURL(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.handleResourceElement(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.access$800(Unknown Source)
at com.sun.javaws.jnl.XMLFormat$2$1.visitElement(Unknown Source)
at com.sun.javaws.jnl.XMLUtils.visitChildrenElements(Unknown Source)
at com.sun.javaws.jnl.XMLFormat$2.visitElement(Unknown Source)
at com.sun.javaws.jnl.XMLUtils.visitElements(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.buildResourcesDesc(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptorFromCache(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptorFromCache(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$200(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error while initializing manager: BadFieldException[ The field <extension>href has an invalid value: C:\Users\Chris\Desktop\ArFile Clients,C:\Users\Chris\Desktop\ArFile Clients], bail out
BadFieldException[ The field <extension>href has an invalid value: C:\Users\Chris\Desktop\ArFile Clients,C:\Users\Chris\Desktop\ArFile Clients]
at com.sun.javaws.jnl.XMLUtils.getAttributeURL(Unknown Source)
at com.sun.javaws.jnl.XMLUtils.getRequiredURL(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.handleResourceElement(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.access$800(Unknown Source)
at com.sun.javaws.jnl.XMLFormat$2$1.visitElement(Unknown Source)
at com.sun.javaws.jnl.XMLUtils.visitChildrenElements(Unknown Source)
at com.sun.javaws.jnl.XMLFormat$2.visitElement(Unknown Source)
at com.sun.javaws.jnl.XMLUtils.visitElements(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.buildResourcesDesc(Unknown Source)
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptorFromCache(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptorFromCache(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$200(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error while initializing manager: BadFieldException[ The field <extension>href has an invalid value: C:\Users\Chris\Desktop\ArFile Clients,C:\Users\Chris\Desktop\ArFile Clients], bail out