JApplet と Java Web Start を使用しているときにテキスト ファイルを読み込もうとすると問題が発生します。基本的に、読み込みたいユーザー データを含むファイルがあります。テキスト ファイルは Web サーバーに保存されます。コードは次のとおりです。
company.readCompanyFile("file:///C:/Users/Chris/Desktop/ArFile Clients/" + companyName + "/"
+ companyName + ".cmp");
readCompanyFile 関数は次のとおりです。
public void readCompanyFile(String cname)
{
try
{
BufferedReader br = new BufferedReader(new FileReader(cname));
name = br.readLine();
quota = Float.parseFloat(br.readLine());
String s;
while ((s = br.readLine()) != null)
{
String[] parts = s.split(":");
metadataFields.add(parts);
}
br.close();
}
catch(IOException e)
{
System.out.println("File does not exist, or has invalid format");
}
}
Java Web Start 経由で起動しようとすると、次のエラーがスローされます
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