java µ÷ÓÃϵͳ¿ÉÖ´ÐгÌÐò
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class RunDosCommand {
public static void main(String[] args) throws IOException {
String cmd = "ipconfig";
Runtime run = Runtime.getRuntime();
Process p = run.exec(cmd);
BufferedInputStream in = new BufferedInputStream(p.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String s;
while ((s = br.readLine()) != null)
System.out.println(s);
}
}
Êä³ö½á¹û£º
Windows IP Configuration
Ethernet adapter 區Óò連線:
Connection-specific DNS Suffix . : iacp.iac
IP Address. . . . . . . . . . . . : 10.162.54.45
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 10.162.54.1
Ethernet adapter 無線網·連線:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter VirtualBox Host-Only Network:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.56.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Êä³öµÄ½á¹ûÒòµçÄԵIJ»Í¬£¬¶ø²»Ïàͬ¡£
×¢£ºÕâÑùµÄÇé¿öÏ£¬ÊDz»»áÓÐDos´°¿Úµ¯³öµÄ¡£
public class RunDosCommand {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
String path = System.getProperty("user.dir")+"/command/d.bat";
Runtime run = Runtime.getRuntime();
Process process = run.exec("cmd.exe /c start "+path);
}
}
Ö´ÐÐd.batÖеÄÃüÁî¡£
Ïà¹ØÎĵµ£º
1.²ð·Ö×Ö·û´®
Óöµ½ÌØÊâ×Ö·û£¬±ÈÈ磺¶Ô‘$’·ûºÅ£¬¾ÍÓ¦¸ÃʹÓÑ\\$’£¬ºó×ܽá¿ÉÒÔ¼Ó¸ö·½À¨ºÅÈç "[.]"¡£
2.±éÀúHASHMAP
Iterator itr = map.keySet().itrator();
while(itr.hasNext())
{
Object temp1 = itr.next();
Object temp2 = tab.get(temp1);
}
......
½«×Ö´® String ת»»³ÉÊý×ÖÀàÐÍ
String ת int
1.) int i = Integer.parseInt([String]); »ò i = Integer.parseInt([String],[int radix]);
2.) int i = Integer.valueOf(my_str).intValue();
String ת Float
Float f = Integer.valueOf(my_str).floatValue();
String ת float
float f=new Float(my+str).floa ......
ÔÚ³ÌÐòÖУ¬Îı¾Îļþ¾³£ÓÃÀ´´æ´¢±ê×¼µÄASCIIÂëÎı¾£¬±ÈÈçÓ¢ÎÄ¡¢¼Ó¼õ³Ë³ýµÈºÅÕâЩÔËËã·ûºÅ¡£Îı¾ÎļþÒ²¿ÉÄÜÓÃÓڴ洢һЩÆäËû·ÇASCII×Ö·û£¬Èç»ùÓÚ
GBKµÄ¼òÌåÖÐÎÄ£¬»ùÓÚBIG5µÄ·±ÌåÖÐÎĵȵȡ£ÔÚ´æ´¢ÕâЩ×Ö·ûʱÐèÒªÕýÈ·Ö¸¶¨ÎļþµÄ±àÂë¸ñʽ£»¶øÔÚ¶ÁÈ¡ÕâЩÎı¾Îļþʱ£¬ÓÐʱºò¾ÍÐèÒª×Ô¶¯Åж¨ÎļþµÄ±àÂë
¸ñʽ¡£
°´ÕÕ¸ø¶¨µÄ×Ö·û¼¯´ ......
¡¾1¡¿Í¨¹ý¿´ÕâÌ×ÊÓƵÎÒѧµ½ÁËÃæÊԵļ¼ÇÉ£¬ÒÔ¼°Ò»Ð©ÐèÒª¼ÇסµÄÃæÊÔÌâ
¡¾2¡¿Í¨¹ý¿´ÊÓƵÎÒѧµ½ÁËÔõÑùȥѧϰ£¬ÔõÑùÔÚ¶Ìʱ¼äÄڰѸÃÓõļ¼Êõѧ»á£¬Í¨¹ý²é¿´×ÊÁÏÆ©ÈçAPIµÈ£¬¶øÇÒ»¹Ñ§»áÁËÏÖѧÏÖÂô£¬»îѧ»îÓÃ
¡¾3¡¿Ê²Ã´ÊÇIDEÓ¦ÓóÌÐò¿ª·¢¹¤¾ß
¡¾4¡¿MyEclipseµÄһЩʹÓÃС¼¼ÇÉ£¬Í¨¹ýÕâЩС¼¼ÇÉ¿ÉÒÔÔö¼Ó¿ª·¢Ð§ÂÊ
£¨¿ì½Ý¼ü£©£¨javaÄ ......
ÒòΪ³ÌÐòÒª´ÓÊý¾Ý¶ÁÈ¡½ü10WÐмǼ´¦Àí£¬µ±¶Áµ½9WµÄʱºò¾Í³öÏÖ java.lang.OutOfMemoryError: Java heap space ÕâÑùµÄ´íÎó¡£
ÔÚÍøÉÏÒ»²é¿ÉÄÜÊÇJAVAµÄ¶ÑÕ»ÉèÖÃ̫СµÄÔÒò¡£
¸ú¾ÝÍøÉϵĴ𰸴óÖÂÓÐÕâÁ½ÖÖ½â¾ö·½·¨£º
1¡¢ÉèÖû·¾³±äÁ¿
set JAVA_OPTS= -Xms32m -Xmx512m
¿ÉÒÔ¸ù¾Ý×Ô¼º»úÆ÷µÄÄÚ´æ½øÐиü¸Ä,µ«±¾È˲âÊÔÕâÖÖ· ......