lastModified() 方法肯定是不灵的用那个Runtime.getRuntime().exec()方法具体怎么做啊
解决方案 »
- httpclient返回302后,其location的值为./ 跳转出错,请大侠帮着看看是什么原因。
- jvm运行中出现的致命问题“Out of swap space”
- ftp上传文件???
- ImageIcon能使用JAR里面的图片吗?
- 小问题,大实现!请大G,大J进!谢谢`~
- 一段简单的程序
- 初学java,请教JComboBox选项判断的问题
- 我的机器里为什么有许多个jdkx.x.x\bin
- 4 | 7的结果是什么?为什么?4 & 7呢?
- 有谁知道policytool是干什么的,能解决applet访问数据库的问题吗??100分,跟贴有分!
- 我的连接池是否已经释放?
- 急求高手帮忙JTable问题!!
好奇怪的问题你可以在FILE NEW 的前或者后取SYSTEM current time 就可以算是了如果你想算精确的时间
可以取前后的时间差
public class Test {
public static void main(String[] args) {
try {
Process p = Runtime.getRuntime().exec("cmd /C dir c:\\temp\\xx.txt /tc");
InputStream is = p.getInputStream();
int i;
while((i=is.read())!=-1) System.out.print((char)i);
} catch (java.io.IOException exc) { exc.printStackTrace(); }
}
}
代码如下:
/*
* FirstTest.java
*
* Created on 2006年7月12日, 下午3:25
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/package firstnetbeanspro;
import java.io.*;
/**
*
* @author xiaotang
*/
public class FirstTest {
/** Creates a new instance of FirstTest */
public FirstTest() {
}
public static void main(String[] args) {
try {
Process p = Runtime.getRuntime().exec("cmd /C dir c:\\reponse.log /tc");
InputStream is = p.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
StringBuffer sb = new StringBuffer();
String str;
int i=0;
while((str = br.readLine()) != null){
i++;
if(i == 6){
System.out.println(str.substring(0,17));
}
}
} catch (java.io.IOException exc) {
exc.printStackTrace();
}
}
}