http://java.sun.com/products/jdk/1.2/docs/api/java/io/File.html#renameTo(java.io.File)public boolean renameTo(File dest)
解决方案 »
- 谁能教教我Dreamwerver里iframe的用法啊?
- 一个javascript问题
- 刚学Servlet的问题!
- 图片在数据库里如何存储?想知道……
- JSP变量问题!
- javascript 里的iframe 眺转问题
- 数据增加到数据的同时,生成一个静态页面(内容就是增加的内容),大家是怎么处理的.
- 我在jsp中提交textarea到sybase中,然后用Pb的数据窗口调出该字段记录,应该怎么处理回车?
- 有谁搞过jsp+PostgreSQL模式的开发,谈谈经验
- 请问怎样在servlet启动的时候执行一些自己的初始化工作
- 我在做一个论坛,怎样解决在发表文章框内写入HTML语句的问题。很详细,在线等。谢了。
- ●●●● (高分、在线等您回答)为什么我拖动图片时,连线不随着图片移动!!程序如下:能否修改或指点
Renames the file denoted by this abstract pathname.
Parameters:
dest - The new abstract pathname for the named file
Returns:
true if and only if the renaming succeeded; false otherwise
Throws:
SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.io.FileDescriptor) method denies write access to both the old and new pathnames
NullPointerException - If parameter dest is null
File file1=new File(rel+"txt1.htm");
File file2=new File(rel+"txt2.htm");
if(file1.exists()){
file1.renameTo(file2);
}
//把服务器根目录下的txt1.htm改名成了txt2.htm
D:\bea2\user_projects\hyf\myserver\.wlnotdelete\DefaultWebApp_DefaultWebApp_169390\jsp_servlet\_newemail\__upload_ok.java:129: reference to File is ambiguous, both class java.io.File in java.io and class com.jspsmart.upload.File in com.jspsmart.upload match
File file1=new File(rel+"cs15.rar"); //[ /newemail/upload_ok.jsp; Line: 55]
^
D:\bea2\user_projects\hyf\myserver\.wlnotdelete\DefaultWebApp_DefaultWebApp_169390\jsp_servlet\_newemail\__upload_ok.java:129: reference to File is ambiguous, both class java.io.File in java.io and class com.jspsmart.upload.File in com.jspsmart.upload match
File file1=new File(rel+"cs15.rar"); //[ /newemail/upload_ok.jsp; Line: 55]
^
D:\bea2\user_projects\hyf\myserver\.wlnotdelete\DefaultWebApp_DefaultWebApp_169390\jsp_servlet\_newemail\__upload_ok.java:130: reference to File is ambiguous, both class java.io.File in java.io and class com.jspsmart.upload.File in com.jspsmart.upload match
File file2=new File(rel+"cs.rar"); //[ /newemail/upload_ok.jsp; Line: 56]
^
D:\bea2\user_projects\hyf\myserver\.wlnotdelete\DefaultWebApp_DefaultWebApp_169390\jsp_servlet\_newemail\__upload_ok.java:130: reference to File is ambiguous, both class java.io.File in java.io and class com.jspsmart.upload.File in com.jspsmart.upload match
File file2=new File(rel+"cs.rar"); //[ /newemail/upload_ok.jsp; Line: 56]
^
Note: D:\bea2\user_projects\hyf\myserver\.wlnotdelete\DefaultWebApp_DefaultWebApp_169390\jsp_servlet\_newemail\__upload_ok.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
or
com.jspsmart.upload.File file1=...
String rel=request.getRealPath("/");
java.io.File file1=new java.io.File(rel+"txt1.htm");
java.io.File file2=new java.io.File(rel+"txt2.htm");
if(file1.exists()){
file1.renameTo(file2);
}
就可以了.