Java µ÷ÓÃEXE
ʹÓÃRuntime.getRuntime().exec()·½·¨¿ÉÒÔÔÚjava³ÌÐòÀïÔËÐÐÍⲿ³ÌÐò.
¸Ã·½·¨ÓÐ6¸ö¿É·ÃÎÊ°æ±¾:
1.exec(String command)
2.exec(String command, String envp[], File dir)
3.exec(String cmd, String envp[])
4.exec(String cmdarray[])
5.exec(String cmdarray[], String envp[])
6.exec(String cmdarray[], String envp[], File dir)
Ò»°ãµÄÓ¦ÓóÌÐò¿ÉÒÔÖ±½ÓʹÓõÚÒ»°æ±¾,µ±Óл·¾³±äÁ¿´«µÝµÄʱºòʹÓúóÃæµÄ°æ±¾.
ÆäÖÐ2ºÍ6°æ±¾¿ÉÒÔ´«µÝÒ»¸öĿ¼,±êʶµ±Ç°Ä¿Â¼,ÒòΪÓÐЩ³ÌÐòÊÇʹÓÃÏà¶ÔĿ¼µÄ,ËùÒÔ¾ÍҪʹÓÃÕâ¸ö°æ±¾.
µ±ÒªÖ´ÐÐÅú´¦ÀíµÄʱºò,²»ÄÜÖ±½Ó´«µÝÅú´¦ÀíµÄÎļþÃû,¶øҪʹÓÃ:
cmd.exe /C start Åú´¦ÀíÎļþÃû
ʹÓÃdosÃüÁî(±ÈÈçdir)ʱҲҪʹÓõôµ÷ÓÃ.
Èç¹ûÏëÓëµ÷ÓõijÌÐò½øÐн»»¥,ÄÇô¾ÍҪʹÓø÷½·¨µÄ·µ»Ø¶ÔÏóProcessÁË,ͨ¹ýProcessµÄgetInputStream(),getOutputStream(),getErrorStream()·½·¨¿ÉÒԵõ½ÊäÈëÊä³öÁ÷,È»ºóͨ¹ýInputStream¿ÉÒԵõ½³ÌÐò¶Ô¿ØÖÆ̨µÄÊä³öÐÅÏ¢,ͨ¹ýOutputStream¿ÉÒÔ¸ø³ÌÐòÊäÈëÖ¸Áî,ÕâÑù¾Í´ïµ½Á˳ÌÐòµÄ½»»»¹¦ÄÜ.
Àý×ÓÈçÏÂ:
package com.broadcontact.netadmin.schedule;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Date;
import java.io.StringReader;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.File;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
/**
* <p>Title: netadmin</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company:
Ïà¹ØÎĵµ£º
¹ØÓÚ Java Concurrency
×Ô´ÓJavaµ®Éú֮ʱ£¬Java ¾ÍÖ§³Ö²¢ÐеĸÅÄ±ÈÈçÏ̺߳ÍËø»úÖÆ¡£Õâ¸ö½Ì³Ì°ïÖú¿ª·¢¶àÏß³ÌJava³ÌÐòÔ±Äܹ»Àí½âºËÐĵÄJava²¢ÐÐÀíÄîÒÔ¼°ÈçºÎʹÓÃËûÃÇ¡£ ÄÚÈÝÉæ¼°µ½JavaÓïÑÔÖеÄỊ̈߳¬ ÖØÁ·¼¶ÒÔ¼°ÇáÁ¿¼¶Í¬²½»úÖÆ ÒÔ¼°JavaSE 5 ÖеÄËø£¬Ô×ÓÁ¿ ²¢ÐÐÈÝÆ÷£¬Ï̵߳÷¶È ÒÔ¼°Ïß³ÌÖ´ÐÐÕß ......
1.ÔÚÄã¾õµÃÓдíµÄµØ·½ÉèÖöϵã
2.µã»÷¼×¿Ç³æÒ»ÑùµÄ°´Å¥ÏÂÃæµÄ×Ó°´Å¥£¬Ò²ÊǼ׿dzæÒ»ÑùµÄ£¬½ÐDebug
3.ÔËÐгÌÐò£¬µ±³ÌÐòÔËÐе½¸Õ²ÅÉèÖöϵãµÄλÖþͻáÍ£ÏÂÀ´£¬²¢ÇÒÄÇÐдúÂëµ×É«»á¸ßÁÁÏÔʾ¡£
4.½Ó×ÅÄãÔÚÈçϽçÃæÄã¿ÉÒÔ¿´µ½ÄãÏëÒªµÄÐÅÏ¢
5.ÔÚVariablesÀïÃæ¿ÉÒԲ鿴ËùÓбäÁ¿µÄÖµ£¬±ÈÈç¸Õ²ÅÉèÖõĶϵãÀïÃæµÄstrClassNameµÄÖµ¾Í ......
¹Ø¼ü×Ö: µ×²ãÊý¾Ý Ãû´Ê½âÊÍ£º ²¹Â룺1 ÔÚ¼ÆËã»úϵͳÖУ¬ÊýÖµÒ»ÂÉÓв¹ÂëÀ´±íʾ(´æ´¢). ʹÓò¹Âë,¿ÉÒÔ½«·ûºÅλºÍÆäËûλͳһ´¦Àí;ͬʱ,¼õ·¨Ò²¿É°´¼Ó·¨À´´¦Àí.ÁíÍâ,Á½¸öÓò¹Âë±íʾµÄÊý¾ÝÏà¼Óʱºò,Èç¹û×î¸ßλ(·ûºÅλ)Óнøλ,Ôò½øÎ¥±»ÉáÆú. 2 ²¹ÂëÓëÔÂëµÄת»»¹ý³Ì¼¸ºõÊÇÏàͬµÄ ÊýÖµµÄ²¹Âë±íʾҲ·ÖÁ½ÖÖÇé¿ö£º £¨1£©ÕýÊýµÄ²¹Âë:ÓëÔ ......
/**
* Copyright (c) 2010 IBOBO Corporation. All Rights Reserved.
*/
package com.ibm.util.dao.hib;
/**
* [Java Generics] get T.Class from <T>
*
* @author <a ......
JavaÓïÑÔµÄ26¸öϸ½Ú[תÔØ]
Java×÷ΪһÃÅÓÅÐãµÄÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼ÆÓïÑÔ,ÕýÔÚ±»Ô½À´Ô½¶àµÄÈËʹÓᣱ¾ÎÄÊÔͼÁгö×÷ÕßÔÚʵ¼Ê¿ª·¢ÖÐÅöµ½µÄһЩJavaÓïÑÔµÄÈÝÒ×±»È˺öÊÓµÄϸ½Ú,Ï£ÍûÄܸøÕýÔÚѧϰJavaÓïÑÔµÄÈËÓÐËù°ïÖú¡£
1£¬Î»ÒÆÔËËãÔ½½çÔõô´¦Àí
¿¼²ìÏÂÃæµÄ´úÂëÊä³ö½á¹ûÊǶàÉÙ?
int a=5;
......