Java Web Start 应用程序可以从本地系统读取文件,但不能写入 [英] Java Web Start Application can read files from local systems, but not write

查看:44
本文介绍了Java Web Start 应用程序可以从本地系统读取文件,但不能写入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请询问您是否需要更多信息.我有安全和所有权限标签在我的 jnlp 中,当我离线运行我的 Java 应用程序时,它可以正常工作.

please ask if you need more info. I have the security and all permissions tags in my jnlp, and when I run my java app offline it works correctly.

File T = new File(System.getProperty("user.home") + File.separator + ".myapp/");<br />
if(!T.exists())
    T.mkdirs();
File[] temp=new File[2];

temp[0] = new File(System.getProperty("user.home") + File.separator +
                   ".myapp"+File.separator+"temp1.txt");
temp[1] = new File(System.getProperty("user.home") + File.separator +
                   ".myapp"+File.separator+"temp2.txt");

writer=new BufferedWriter(new FileWriter(temp[x]));
writer.write(finalData);
writer.close();

我使用以下方法写入我想在用户系统目录中创建的文件.在程序中,我也从同一个文件夹中读取数据,当我将测试数据放入该文件夹时,它可以正常工作.当我删除 temp1.txt 和 temp2.​​txt 文件时,它不会读取任何数据.没有出现错误消息或任何东西.

I use the following method to write to files I want to create in a directory in the user's system. In the program, I also read from the same folder and when I place test data in that folder it works correctly. When I remove the temp1.txt and temp2.txt files it does not read any data. No error messages come up or anything.

重申一下,在 java web start 中运行时,会弹出窗口并且程序正确运行,没有错误消息,但它没有将文件正确写入用户系统.同时,在.txt文件中提供测试数据时,正确读取.

To reiterate, when ran in java web start, the window pops up and the program runs correctly with no error messages, but it does not write the files properly to the users system. At the same time, when test data is provided in .txt files, it reads it correctly.

如果可能的话,是否有不使用某些 javaw.jnlp.* 方法的解决方案?该程序确实必须有一个包含 .txt 文件的文件夹来读取

If it is at all possible, could there be a solution without using some of the javaw.jnlp.* methods? The program really has to have a folder with .txt files to read from

edit2:我所有的罐子也都签名了

edit2: All my jars are signed as well

推荐答案

抱歉各位,我是个白痴.我的 jnlp 文件指向本地系统中不同版本的 java 程序,基本上我是个白痴.回家后,我在家里的电脑上测试了网站,发现了我的错误.

Sorry guys, I was an idiot. My jnlp file pointed to a different version of my java program in my local system and basically I'm an idiot. When I went home, I tested the website from my home pc and found my error.

非常感谢您的帮助!

这篇关于Java Web Start 应用程序可以从本地系统读取文件,但不能写入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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