JavaÈçºÎµ÷ÓÃÍⲿÍⲿÃüÁ
JavaÈçºÎµ÷ÓÃÍⲿÍⲿÃüÁ
ÎÒ×Ô¼ºµÄÌå»áÊÇÓÃRuntime.getRuntime.exec(cmd);
Æ©ÈçÏÂÃæÕâ¸ö´úÂ룺
String[] cmd = new String[3]£»
if( osName.equals( "Windows NT" )||osName.equals( "Windows 2000" ))
{
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
}
else if(osName.equals("Linux"))
{
cmd[0]="sh"
cmd[1]£½linuxϵÄij¸öĿ¼
}
else if( osName.equals( "Windows 98" ) )
{
cmd[0] = "command.com" ;
cmd[1] = "/C" ;
}
cmd[2] = "mysqldump --opt -u root yh_tpl > "+backup_path+filename+".sql";
Process ps = Runtime.getRuntime().exec(cmd);
½ñÌì¿´µ½Á˱ðÈ˻ظ´ÕâÀàÎÊÌ⣬ÓÐÕâÑùÒ»µãÒÔǰ²»ÖªµÀ£º
javaÖе÷ÓÃexecÍêÈ«ÍÑÀëÁËjavaµÄjvm£¬Òò´ËÒÔºóµÄÔËÐл·¾³ÐèÒª×Ô¼ºÎ¬»¤¡£
======================================================================================================
Javaµ÷ÓÃÍⲿ³ÌÐòµÄ·½·¨
×÷Õߣº³Â¸Õ£¬¹ðÁÖÈË,97Äê±ÏÒµÓÚ¹ãÎ÷ʦ·¶´óѧÊýѧϵ£¬ÔÝÓÚIBMÖйúÑо¿ÖÐÐļæÖ°´ÓÊÂÈí¼þ¿ª·¢(2004.2-?)£¬×¨×¢»ùÓÚjavaƽ̨µÄÈí¼þ¿ª·¢¡£
email: glchengang@hotmail.com
blog: glchengang.yeah.net
×î½ü¿ª·¢±¨±íÄ£¿é£¬Éú³É±¨±íÎļþºó(Ò»¸öExcelÎļþ)Òª½«´ËÎļþ´ò¡£ºÜ¼òµ¥£¬Ê¹ÓÃJavaµ÷ÓÃÍⲿ³ÌÐòµÄ·½·¨¼´¿É¡£´úÂëÈçÏ£º
String path = "C:/±¨±í_20040504.xls";
try {
¡¡¡¡//Ï൱ÓÚwindowµÄ"¿ªÊ¼"->"ÔËÐÐ"µÄЧ¹û
Runtime.getRuntime().exec("cmd /c start " + path);
} catch (IOException e) {
e.printStackTrace();
}
µ«Èç¹ûÎļþµÄ·¾¶Öаüº¬ÓпոñÉÏÃæµÄ·½·¨¾Í»á³ö´í¡£µ½google¿ñËÑÒ»Æø,ûÓÐ,¿´cmd /?°ïÖúҲûÓÐ,ÊÔÁ˺öà´Î,·¢ÏÖ½â¾ö°ì·¨ÆäʵºÜ¼òµ¥,ÕæÊÇÓÞÃÁ¡£´úÂëÈçÏ£¬ÎÞÐë¶àÑÔ¡£
String path = "C:/Documents and Settings/Giles/×ÀÃæ/±¨±í_20040504.xls";
try {
Runtime.getRuntime().exec("cmd /c start excel \"" + path + "\"");
} catch (IOException e
Ïà¹ØÎĵµ£º
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
import com.sun.image.codec.jpeg.JPEGCodec;
import com ......
1 JAVAµÄ·´Éä,Æäʵ¾ÍÊÇͨ¹ýÒ»¸öʵÀý»¯µÄ¶ÔÏó·´¹ýÀ´È¥ÕÒµ½Ò»¸öÀàµÄÍêÕûÐÅÏ¢,±ÈÈç¶ÔÓÚÈçϵÄÐÎʽ:
X x=new X();
x.getClass().getName();
ÕâÀï¾Í»áÊä³öÕâ¸öÀàËùÔÚµÄÍêÕûÐÅÏ¢,¼´"°üÃû.ÀàÃû";
×î³£ÓõÄÈýÖÖʵÀý»¯CLASSÀà¶ÔÏó
Class<?> c1 = null ; // Ö¸¶¨·ºÐÍ
Class<?& ......
ÖÚËùÖÜÖª£¬javaµÄÖÐÎÄÎÊÌâÒ»Ö±ÊÇÒ»¸öÀÏ´óÄѵÄÎÊÌ⣬Õâ¸öÏÖÏó¿ÉÒÔÔÚcsdnÖÐjavaÂÛ̳Àï¹ØÓÚÖÐÎÄÂÒÂëµÄÌáÎÊÂʾͿÉÒÔÁ˽⵽£¬ÉõÖÁÈí¼þ¾ÞÈËIBMרÃÅ¿ª±ÙÁËÒ»¸ö½â¾öÖÐÎÄÎÊÌâµÄ×¨Çø£¬×÷Ϊһ¸öË×ÈË£¨Ò»Ö±ÃÎÏëÏ£ÍûÏë½ð¿ÀûÄÇÑù³ÉΪһ¸ö“Ã°ÅÆÌìÉñ”£¬Ö»ÊÇһֱûÓгɹ¦£¬Ò²ÐíÊÇÒòΪÉϵ۲»ÕÕ¹ËÖйú°É£©£¬ÎÒҲΪͬÒâµÄÎÊÌâÀ§ÈÅ£ ......
·´Éä»úÖÆ:ËùνµÄ·´Éä»úÖÆ¾ÍÊÇjava
ÓïÑÔÔÚÔËÐÐʱӵ
ÓÐÒ»Ïî×Ô¹ÛµÄÄÜÁ¦¡£Í¨¹ýÕâÖÖÄÜÁ¦¿ÉÒÔ³¹µ×µÄÁ˽â×ÔÉíµÄÇé¿öΪÏÂÒ»²½µÄ¶¯×÷×ö×¼±¸¡£ÏÂÃæ¾ßÌå½éÉÜÒ»ÏÂjava
µÄ·´Éä»úÖÆ¡£ÕâÀïÄ㽫µß¸²ÔÀ´¶ÔjavaµÄÀí½â¡£
JavaµÄ·´Éä»úÖÆµÄʵÏÖÒª½èÖúÓÚ4¸öÀࣺclass£¬Constructor£¬Field£¬Method£»ÆäÖÐclass´ú±íµÄʱÀà¶Ô
Ïó£¬Constructo ......
ΪÁ˰Ñѧµ½ÖªÊ¶×ܽáÆðÀ´£¬ÌØ¿ª´ËÎÄ¡£Ö÷ÒªÊǰÑÿÌìѧµ½µÄ¶«Î÷¼ÓÒԼǼ£¬²»ÖÁÓÚ±ä³É´ó¹·ÐÜ¡£
20100310
½ñÌìÔÚÂÛ̳¿´ÈË·¢ÁËÁ½µÀjavaÌ⣬²»´í£¬°ÑÎÊÌâºÍ´ð°¸¶¼¼Ó½øÀ´£¬ÒÔ±ãÒÔºó²Î¿¼¡£
ÎÊÌâ:
ÒªÇóʵÏÖ·½·¨ÀïÃæµÄ´úÂ룺
1. function1()
·µ»ØÏàͬ闊¶È數×ÖÐÍ×Ö´®. Àý:
function1(“000000 ......