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 ......
Ò»¡¢IOÁ÷µÄÈýÖÖ·ÖÀ෽ʽ
1.°´Á÷µÄ·½Ïò·ÖΪ£ºÊäÈëÁ÷ºÍÊä³öÁ÷
2.°´Á÷µÄÊý¾Ýµ¥Î»²»Í¬·ÖΪ£º×Ö½ÚÁ÷ºÍ×Ö·ûÁ÷
&n ......
×¢Ò⣺ÔÚJava MEƽ̨ÉÏ»ñÈ¡ÊÖ»ú´®ºÅ£¬ÔÚijЩÊÖ»úÖÐÊÇ¿ÉÐе쬵«ÊÇijЩÊÖ»úÖоÍÊÇÎÞ·¨»ñÈ¡µÄ¡£¶ÔÓÚ¼´±ãÊÇ¿ÉÒÔ»ñÈ¡´®ºÅµÄÊÖ»úÀ´Ëµ£¬Ò²½ö½öÏÞÓÚ½øÐÐÁËÇ©ÃûµÄÓ¦ÓóÌÐò²Å¿ÉÒÔ»ñµÃÊÖ»ú´®ºÅ¡£
ÔÚŵ»ùÑÇÊÖ»úÖУ¬ÎÒÃÇ¿ÉÒÔÕâÑù»ñÈ¡ÊÖ»ú´®ºÅ£º System.getProperty("com.nokia.mid.imei")
ÔÚSeries60ƽ̨µÄÊÖ¼¸ÖÖ£¬ ......
Ò»£¬ package,importÒýÈëÔÒò£º
package:
ÎÒÃǶ¼ÊìϤ³¬ÊУ¬³¬ÊÐËäÈ»ÅӴ󣬶«Î÷·±¶à£¬µ«È´¹ÜÀíµÄ¾®¾®ÓÐÌõ£¬µ±ÕÒijÑù¶«¶«Ê±£¬ÎÒÃÇÒ²ºÜÈÝÒ×ÕÒ
µ½£¬ËüµÄÒ»¸öÖØÒªµÄÔÒò¾ÍÊDzÉÓÃÁË·ÖÀà·ÅÖûúÖÆ£¬ÎïÆ··ÖÃűðÀà·ÅÖÃÔÚרÃŵÄÇøÓò£¬¼È·½±ã¹ÜÀí£¬ÓÖ·½±ãѰÕÒ
PackageÒ²ÊÇÒ»¸ö·ÖÀà·ÅÖö«¶«µÄÇøÓò£¬²»¹ýËü·Åµ ......
Java¼¼Êõ·Ïßͼ
Ìáʾ£ºÇ°ÎĶÔJava¼¼Êõ×öÁË¿ò¼ÜÐԵķÖÎö£¬°üÀ¨Java SE¡¢Java EEºÍJava ME£¬ÈöÁÕßÁ˽âÁËJavaÓÉÄÄЩ¼¼Êõ×é³É¡£ÎªÁËϵͳµØÑ§Ï°ÕâЩ¼¼Êõ£¬±¾ÎĽ«Öƶ¨Ò»Ì×ÍêÕûµÄJava¼¼Êõѧϰ·Ïß¡£
´ÓǰÎÄÖÐÎÒÃÇÒѾÁ˽⵽£¬Java SEÖаüº¬ÁËJavaµÄ»ù´¡¼¼Êõ£¬Java EEÖаüº¬ÁËÍøÂçÓ¦Óÿª·¢µÄ¸÷ÖÖ¼¼Êõ£¬Java MEÖаüº¬ÁËÒÆ¶¯É豸Ӧ ......