菜鸟请教读文件问题
package myone ;
import java.io.*;
import java.util.*;
public class news
{
String path;
StringBuffer newstext = new StringBuffer();
byte buff[] = new byte[999999999];
int maxnews = 0;
int count = 0;
public void setpath(String path)
{
this.path = path;
}
public String getpath()
{
return path;
}
public String gettext()
{
try
{
FileInputStream news = new FileInputStream(path);
int i = news.read(buff);
if (i != -1)
{
newstext.append(new String(buff));
}
}
catch (Exception e)
{
System.out.println(e);
}
String text = new String(newstext);
return text;
}
我使用这么一个bean来读文本文件,,放到服务器上后开始使用相对路径能找到文件,修改文本内容后重启动服务器后就提示找不到指定路径,我就修改成绝对路径重启后还是提示找不到,请问怎么解决?