Javaµ÷ÓÃWMICÃüÁîµÄ·½·¨
½ñÌìҪд¸öÔ¶³ÌÖØÆô·þÎñµÄ¹¦ÄÜ£¬ÎªÁË¿ª·¢Ëٶȣ¬ÔÝʱ¶¨ÎªJava´úÂë+WMICÃüÁîµÄ·½·¨£¬¼òµ¥µÄ˵£¬¾ÍÊÇÀûÓÃJavaµ÷Óñ¾»úÓ¦ÓóÌÐòµÄ·½·¨¡£Éæ¼°µ½µÄJavaÀàÓÐjava.lang°üÀïÃæµÄRuntime¡¢Process¡¢ProcessBuilderÈý¸öÀ࣬ÒÔ¼°wmicÖÐÖØÆô·þÎñµÄÃüÁî¡£ÒòΪ֮ǰҲд¹ýÕâ·½ÃæµÄ¶«Î÷£¬ËùÒÔºÜÏ°¹ßÐÔµÄд³öÁË´úÂ룺
Process p = Runtime.getRuntime().exec("wmic ...");
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String tmp = null;
while ((tmp = br.readline()) != null) {
System.out.println(tmp);
}
int exitValue = p.waitfor();
ÔËÐУ¬½á¹û·¢ÏÖ³ÌÐò²»ÄÜÍ˳ö£¬Debug·¢ÏÖ³ÌÐò×èÈûÔÚbr.readline()ÖÐÁË£¬Ç¿ÖƽáÊø³ÌÐò£¬·¢ÏÖÖØÆô·þÎñµÄÃüÁîÕý³£ÏÂÏÂÈ¥ÁË£¬È¥µô³ÌÐòÖлñµÃ±ê×¼Êä³öµÄµØ·½ºÍ»ñµÃ·µ»Ø½á¹ûµÄµØ·½£¬ÃüÁîÒ²ÄÜÕý³£ÏÂÈ¥£¬¶øÇÒÕý³£Í˳ö¡£
Ϊʲô³ÌÐò»á×èÈûÄØ£¿GoogleÁËһϣ¬·¢ÏÖÁË´ó¼ÒµÄ½âÊÍ£¬Ó¦¸ÃÒ²ÊDZȽÏȨÍþµÄ½âÊÍ°É£ºÃ¿¸ö½ø³Ì¶¼ÓÐ×Ô¼ºµÄ±ê×¼ÊäÈë¡¢±ê×¼Êä³ö¡¢±ê×¼´íÎóÊä³ö£¬¶ÔÓÚijЩÒÀÀµÓÚOSµÄ½ø³Ì£¬¿ÉÄÜÆäÊä³ö»º³åÇøºÜС£¬Èç¹û²»Äܼ°Ê±µÄ¶Á³ö£¨±ê×¼Êä³ö¡¢±ê×¢´íÎóÊä³ö£©£¬½«µ¼Ö½ø³Ì²»ÄÜÕý³£Í˳ö¡£ÎҵijÌÐòÖбê×¼Êä³öÒѾ¶ÁÁË£¬ÏÔÈ»ÔÒò²»ÊÇÕâ¸ö£¬ÄѵÀÊÇ´íÎóÊä³ö»º³åÇøÖеÄÊý¾ÝûÓжÁ³öµ¼Öµģ¿´ø×ÅÕâ¸öÒÉÎÊ£¬¶Ô³ÌÐò×÷ÁËһЩ¸ü¸Ä£º
ProcessBuilder pb = new ProcessBuilder("wmic",...);
pb.redirectErrorStream(true);
Process p = pb.start();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String tmp = null;
while ((tmp = br.readline()) != null) {
System.out.println(tmp);
}
int exitValue = p.waitfor();
±àÒëÔËÐУ¬·¢ÏÖ»¹ÊÇÓÐÎÊÌ⣬ÒÀÈ»»¹ÊÇ×èÈû¡£ÓÖgoogleÁËһϣ¬´ó¼ÒµÄÆÀÂÛ´ó¶à»¹ÊǹØÓÚ±ê×¼Êä³öºÍ±ê×¼´íÎóÊä³ö£¬ÄÇÕâ³ÌÐòÓ¦¸ÃÊÇûÓÐÎÊÌâÁË¡£ºóÀ´ÔÚcmdÖÐÇÃÈëwmicµÄÃüÁ·¢ÏÖwmicÃüÁîÇÃÈëÒÔºó»á½øÈëÒ»¸ö×ÔÓеÄÌáʾ·ûÖУ¬ÄѵÀÊÇÒòΪ±ê×¼ÊäÈëµÄÎÊÌâ¡£ºóÀ´ÓÖgoogleÁËһϣ¬ÑéÖ¤ÁËÎҵIJÂÏ룬¹ûÈ»ÊÇÒòΪwmic½ø³Ì»áµÈ´ý±ê×¼ÊäÈ룬¶ø³ÌÐòÖÐûÓд¦Àí±ê×¼ÊäÈëµÄµØ·½£¬ÊDZê×¼ÊäÈë×èÈûÁ˽ø³ÌµÄÍ˳ö£¬Ð޸ĴúÂ룺
ProcessBuilder pb = new ProcessBuilder("
Ïà¹ØÎĵµ£º
#include <iostream>
using namespace std;
class Base {
public:
virtual void fn(int x) {
cout << "In Base class, int x = " << x << endl;
}
};
class SubClass : public Base {
public:
// º¯ÊýµÄÖØÔØ,ÕâÑùµÄÖØÔØ·½Ê½,ÔÚJavaÖÐÄÜÐÐ,ÔÚC/C++ÖÐÈ´²»ÐÐ
virt ......
Õâ¶Îʱ¼äÔÚ×¢²áÓòÃû£¬ÔÛÆð²½Íí£¬ºÃÓõÄÓòÃû¶¼¸ø±ðÈË×¢²áÁË¡£
ÏëÕÒ¸öλÊýÉÙµÄ.comÓòÃû£¬¿ÉÊÇ·¢Ïִ󲿷ֶ¼×¢²áÁË£¬Ò²¾ÍÊÇ˵£¬ÎÒµã»÷µÄ¶à´Î²éѯ¶¼ÊÇÀË·Ñ¿¨Â·ÀÎҿɲ»Ïë¼õ·Ê£©
ÓÚÊÇ»¨Á˵ãʱ¼ä£¬ÓÃjavaдÁ˸ö¸ù¾ÝÖ¸¶¨Î»Êý²éѯËùÓпÉÓõÄ.comÓòÃûµÄС³ÌÐò¡£ÌṩԴÂëÏÂÔØ¡£
ÎÒÀûÓõÄÊÇwhoisÕâ¸öÓòÃû²éѯÍøվȡµÃÊý¾Ý£¬ÔÚ²âÊÔµ ......
1. ʲôÊÇSerialization?
´®Ðл¯(Serialization)ÊǼÆËã»ú¿ÆѧÖеÄÒ»¸ö¸ÅÄËüÊÇÖ¸½«¶ÔÏó´æ´¢µ½½éÖÊ£¨ÈçÎļþ¡¢ÄÚÔÚ»º³åÇøµÈ£©ÖлòÊÇÒÔ¶þ½øÖÆ·½Ê½Í¨¹ýÍøÂç´«Êä¡£Ö®ºó ¿ÉÒÔͨ¹ý·´´®Ðл¯´ÓÕâЩÁ¬ÐøµÄλÊý¾ÝÖØй¹½¨Ò»¸öÓëÔʼ¶ÔÏó״̬ÏàͬµÄ¶ÔÏó£¬Òò´ËÔÚÌض¨Çé¿öÏÂÒ²¿ÉÒÔ˵Êǵõ½Ò»¸ö¸±±¾£¬µ«²¢²»ÊÇËùÓÐÇé¿ö¶¼ÕâÑù¡£
JavaÓÐS ......
javaÑéÖ¤ÂëµÄʵÏÖ(Ò»)
ÊÕ²Ø
1.ImageServletÀàµÄʵÏÖ£º
package com.mobile.control;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOExcep ......