Java中提示找不到符号,哪位高手给解决一下?谢谢了!

来源:百度知道 编辑:UC知道 时间:2024/06/18 03:37:28
<!% String temp;

%>;
<%
File f=new File("C:/","x.txt");
try{
FileInputStream in =new FileInputStream(f);
BufferedInputStream bufferin =new BufferedInputStream(in);
byte c[] =new byte[150];
int n=0;
//String t1="";
while((n=bufferin.read(c))!=-1)
{ String temp=new String(c,0,n);
//String t1=t1+temp;
out.println(temp);
}
bufferin.close();
in.close();
File f1=new File("C:/","y.txt");
FileOutputStream outfile =new FileOutputStream(f1);
BufferedOutputStream bufferout=new BufferedOutputStream(outfile);
byte b[]=temp.getBytes();
int i=10;
while(i!=0)
{
bufferout.write(b);
i--;
}
bufferout.flush();
bufferout.close();
outfile.close();
}
catch(IOException e)
{}
%>
编译户提示找不到符号:C:\Tomcat 5.0\

你是想把x.txt复制y.txt吧,那按楼上的把temp放到while也不行啊,建议把代码改为:
<%
File f=new File("C:/","x.txt");
String temp="";//修改处
try{
FileInputStream in =new FileInputStream(f);
BufferedInputStream bufferin =new BufferedInputStream(in);
byte c[] =new byte[150];
int n=0;
//String t1="";
while((n=bufferin.read(c))!=-1)
{
temp=temp+new String(c,0,n); //修改处
//String t1=t1+temp;
out.println(temp);
}
bufferin.close();
in.close();
File f1=new File("C:/","y.txt");
FileOutputStream outfile =new FileOutputStream(f1);
BufferedOutputStream bufferout=new BufferedOutputStream(outfile);
byte b[]=temp.getBytes();
int i=10;
while(i!=0)
{
bufferout.write(b);
i--;
}
bufferout.flush();
bufferout.close();
outfile.close();
}
catch(IOException e)
{}
%>

哈哈 是定义的范