ÎÒÏëÓÃJavaдһ¸ö³ÌÐò£¬¾ÍÊÇÎÒÏëÔÚÔËÐдúÂëºó£¬ÔÚÖ¸¶¨µÄʱ¼ä´ò¿ªÄ³³ÌÐò£¬ÀýÈçÎÒÔËÐдúÂëºó£¬½²ÔÚ12£º00´ò¿ª"D:\Program Files\Tencent\QQ2009\Bin\QQ.exe"Õâ¸ö³ÌÐò£¬Çó¸ßÈËÖ¸µã¡£»¹ÓпÉÄܵĻ°ÔÚÖ¸¶¨µÄʱ¼äÀýÈç14£º00¹Ø±Õij¸ö³ÌÐò£¬Ð¡µÜ¸ÕѧJava£¬Íü¸ßÈËÖ¸µã¡£Ð»ÁË
Õâ¸öºÍ¼òµ¥ µ«ÒªÊÇÄãµÄJava³ÌÐòÒ»Ö±ÔËÐÐ×ŲÅÐÐ
ÄÇÑù»¹²»ÈçÓÃWindowsµÄtaskÈÎÎñ¾ÍºÃÁË
»¹ÊǸø¸ø´úÂë ²»Ì«Ï²»¶¸ø´ð°¸ ¸øÆô·¢ÐÔµÄtest
Óõ½ÁËJavaÖÐ Æô¶¯³ÌÐòµÄ·½·¨
Process pro = Runtime.getRuntime().exec("notepad src\\Test1.java");
Java code:
public void testSR(){
long begin = System.currentTimeMillis();
Properties p = System.getProperties();
Enumeration e = p.propertyNames();
while(e.hasMoreElements()){
String str = (String) e.nextElement();
System.out.println(str);
}
try {
Process pro = Runtime.getRuntime().exec("notepad src\\Test1.java");
Thread.sleep(10000);
pro.destroy();
} catch (IOException e1) {
e1.printStackTrace();
}catch (InterruptedException e1) {
e1.printStackTrace();
}
long end = System.currentTimeMillis();
System.out.println("Used time :" + (end - begin));
}
Äãµ÷ÓÃÕâ¸ö·½·¨ÔËÐÐһϿ´¿´ ËûЧ¹ûÄã¾ÍÖªµÀ×Ô¼º¸Ã¿´Äĸö
ÎÒÏÖÔÚÏëÓÃsshÕûºÏÀ´×öÒ»¸öÂÛ̳£¬µ«Êý¾Ý¿â·½Ãæ²»ÐУ¬ÎÒÖ÷Òª²»»áÉæ¼°Êý¾Ý¿â£¬²»ÖªµÀ·¢Ìû±í£¬ºÍ»ØÌû±íÒªÈçºÎÉè¼ÆºÍÇø·Ö¡£²»ÖªµÀËÓÐÒ»¸ö¼òµ¥µÄ˼·£¬À´Éè¼ÆÕâЩ±í¡£Ð»Ð»ÁË¡£
·¢ÌûºÍ»ØÌûÓÃͬһÕÅ±í ¡£·¢Ìû id user ......