Ò»¸ö¼òµ¥javaС³ÌÐò´ò°ü³ÉEXEÔËÐÐÎļþ
ÔÚ²©¿ÍÔ°ÉÏ¿´µ½ÕâÑùµÄ´úÂ룬°ÑËü´ò°ü³ÉÒ»¸öexeÎļþ
public class Test
{
public static void main(String[] args)
{
String str="C:\\Program Files\\Tencent\\TM2009\\Bin\\TM.exe";
try
{
Process p= Runtime.getRuntime().exec(str);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
1.Ê×ÏÈÔÚEclipseÀïÃæ°ÑclassÎļþ´ò°ü³ÉÒ»¸ö.jar°ü
2.jar°üת»»³ÉEXE³ÌÐòʹÓÃEXE4j¹¤¾ß£¬¾ßÌå²Î¿¼
http://binghexunjian.blog.163.com/blog/static/122355152200911323536850/
Ïà¹ØÎĵµ£º
¹Ø¼ü×Ö: µ×²ãÊý¾Ý Ãû´Ê½âÊÍ£º ²¹Â룺1 ÔÚ¼ÆËã»úϵͳÖУ¬ÊýÖµÒ»ÂÉÓв¹ÂëÀ´±íʾ(´æ´¢). ʹÓò¹Âë,¿ÉÒÔ½«·ûºÅλºÍÆäËûλͳһ´¦Àí;ͬʱ,¼õ·¨Ò²¿É°´¼Ó·¨À´´¦Àí.ÁíÍâ,Á½¸öÓò¹Âë±íʾµÄÊý¾ÝÏà¼Óʱºò,Èç¹û×î¸ßλ(·ûºÅλ)Óнøλ,Ôò½øÎ¥±»ÉáÆú. 2 ²¹ÂëÓëÔÂëµÄת»»¹ý³Ì¼¸ºõÊÇÏàͬµÄ ÊýÖµµÄ²¹Âë±íʾҲ·ÖÁ½ÖÖÇé¿ö£º £¨1£©ÕýÊýµÄ²¹Âë:ÓëÔ ......
eclipseÑ¡Ò»¸ö±äÁ¿ºó£¬Õâ¸öÀàÀïµÄ¸Ã±äÁ¿²»±äÉ«ÎÊÌâ½â¾ö£º
alt + shift + o
/**
* дÈëÈÕÖ¾
* filePath ÈÕÖ¾ÎļþµÄ·¾¶
* code ҪдÈëÈÕÖ¾ÎļþµÄÄÚÈÝ
*/
public
static
boolean
print(String filePath,String code) {
try
{
File tofile
=
new
File(filePath);
......
ʹÓÃRuntime.getRuntime().exec()·½·¨¿ÉÒÔÔÚjava³ÌÐòÀïÔËÐÐÍⲿ³ÌÐò.
¸Ã·½·¨ÓÐ6¸ö¿É·ÃÎÊ°æ±¾:
1.exec(String command)
2.exec(String command, String envp[], File dir)
3.exec(String cmd, &n ......
ÔÚEclipseÖÐÁ¬ÉÏjavadocsÎĵµ
Ò»¡¢ °²×°Eclipse
¶þ¡¢ ´ÓOracle¹ÙÍø»òÕßsunÒÔÇ°µÄ¹ÙÍøÉÏÏÂÔØJavaÏàÓ¦µÄdocsÎĵµ
Èý¡¢ & ......