Java SE6µ÷ÓÃJava±àÒëÆ÷µÄÁ½ÖÖз½·¨
ÔںܶàJavaÓ¦ÓÃÖÐÐèÒªÔÚ³ÌÐòÖе÷ÓÃJava±àÒëÆ÷À´±àÒëºÍÔËÐС£µ«ÔÚÔçÆڵİ汾ÖУ¨Java SE5¼°ÒÔÇ°°æ±¾£©ÖÐÖ»ÄÜͨ¹ýtools.jarÖеÄcom.sun.tools.javac°üÀ´µ÷ÓÃJava±àÒëÆ÷£¬µ«ÓÉÓÚtools.jar²»ÊDZê×¼µÄJava¿â£¬ÔÚʹÓÃʱ±ØÐëÒªÉèÖÃÕâ¸öjarµÄ·¾¶¡£¶øÔÚJava SE6ÖÐΪÎÒÃÇÌṩÁ˱ê×¼µÄ°üÀ´²Ù×÷Java±àÒëÆ÷£¬Õâ¾ÍÊÇjavax.tools°ü¡£Ê¹ÓÃÕâ¸ö°ü£¬ÎÒÃÇ¿ÉÒÔ²»Óý«jarÎļþ·¾¶Ìí¼Óµ½classpathÖÐÁË¡£
¡¡¡¡Ò»¡¢Ê¹ÓÃJavaCompiler½Ó¿ÚÀ´±àÒëJavaÔ´³ÌÐò
¡¡¡¡Ê¹ÓÃJava APIÀ´±àÒëJavaÔ´³ÌÐòÓкܶ෽·¨£¬ÏÖÔÚÈÃÎÒÃÇÀ´¿´Ò»ÖÖ×î¼òµ¥µÄ·½·¨£¬Í¨¹ýJavaCompiler½øÐбàÒë¡£
¡¡¡¡ÎÒÃÇ¿ÉÒÔͨ¹ýToolProviderÀàµÄ¾²Ì¬·½·¨getSystemJavaCompilerÀ´µÃµ½Ò»¸öJavaCompiler½Ó¿ÚµÄʵÀý¡£
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
¡¡¡¡JavaCompilerÖÐ×îºËÐĵķ½·¨ÊÇrun¡£Í¨¹ýÕâ¸ö·½·¨¿ÉÒÔ±àÒëjavaÔ´³ÌÐò¡£Õâ¸ö·½·¨ÓÐ3¸ö¹Ì¶¨²ÎÊýºÍ1¸ö¿É±ä²ÎÊý£¨¿É±ä²ÎÊýÊÇ´ÓJave SE5¿ªÊ¼ÌṩµÄÒ»¸öеIJÎÊýÀàÐÍ£¬ÓÃtype… argu±íʾ£©¡£Ç°3¸ö²ÎÊý·Ö±ðÓÃÀ´Îªjava±àÒëÆ÷Ìṩ²ÎÊý¡¢µÃµ½Java±àÒëÆ÷µÄÊä³öÐÅÏ¢ÒÔ¼°½ÓÊÕ±àÒëÆ÷µÄ´íÎóÐÅÏ¢£¬ºóÃæµÄ¿É±ä²ÎÊý¿ÉÒÔ´«ÈëÒ»¸ö»ò¶à¸öJavaÔ´³ÌÐòÎļþ¡£Èç¹ûrun±àÒë³É¹¦£¬·µ»Ø0¡£
int run(InputStream in, OutputStream out, OutputStream err, String... arguments)
¡¡¡¡Èç¹ûÇ°3¸ö²ÎÊý´«ÈëµÄÊÇnull£¬ÄÇôrun·½·¨½«ÒÔ±ê×¼µÄÊäÈë¡¢Êä³ö´úÌ棬¼´System.in¡¢System.outºÍSystem.err¡£Èç¹ûÎÒÃÇÒª±àÒëÒ»¸ötest.javaÎļþ£¬²¢½«Ê¹Óñê×¼ÊäÈëÊä³ö£¬runµÄʹÓ÷½·¨ÈçÏ£º
int results = tool.run(null, null, null, "test.java");
¡¡¡¡ÏÂÃæÊÇʹÓÃJavaCompilerµÄÍêÕû´úÂ룺
import java.io.*;
import javax.tools.*;
public class test_compilerapi
{
¡¡public static void main(String args[]) throws IOException
¡¡{
¡¡¡¡JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
¡¡¡¡int results = compiler.run(null, null, null, "test.java");
¡¡¡¡System.out.println((results == 0)?"±àÒë³É¹¦":"±àÒëʧ°Ü");
¡¡¡¡// ÔÚ³ÌÐòÖÐÔËÐÐtest
¡¡¡¡Runtime run = Runtime.getRuntime();
¡¡¡¡Process p = run.exec("java test");
¡¡¡¡BufferedInputStream in = new BufferedInputStream(p.getInputStream());
¡¡¡¡BufferedReader br = new BufferedReader(new InputStreamReader(in));
¡¡¡¡String s;
¡¡¡¡while ((s = br.readLi
Ïà¹ØÎĵµ£º
1 Ïà¹Ø֪ʶ½éÉÜ
1.1 SMB
MicrosoftÍøÂçÅäÖÃÖÐÖ÷Òª²ÉÓÃSMBÐÎʽʵÏÖÎļþ¹²ÏíºÍ´òÓ¡·þÎñ£¬SMB£¨·þÎñÆ÷ÏûÏ¢¿é£©ÊÇÒ»ÖÖ¿Í»§¶Ë/·þÎñÆ÷Îļþ¹²ÏíÐÒé¡£IBMÓÚ20ÊÀ¼Í80Äê´úÄ©ÆÚ¿ª·¢ÁË·þÎñÆ÷ÐÅÏ¢¿é£¨SMB£©£¬ÓÃÓڹ淶¹²ÏíÍøÂç×ÊÔ´£¨ÈçĿ¼¡¢Îļþ¡¢´òÓ¡»úÒÔ¼°´®Ðж˿ڣ©µÄ½á¹¹¡£ÕâÊÇÒ»ÖÖÇëÇó/ÏìÓ¦ÐÒé¡£ÓëFT ......
ÎÒÔÚѧϰthinking in Java4 µÄʱºò£¬ÔÚ´´½¨×Ô¶¨Òå°üµÄʱºò£¬Åöµ½Á˺ܶà´íÎó£¬ÈÃÎÒÓôÃÆÁ˼¸Ì죬ͨ¹ýÔÚÍøÉϵÄ×ÊÁÏËÑË÷£¬°Ñ°üµÄ´´½¨¹ý³Ì¸ø´ó¼ÒÏêϸÁгöÀ´¡£
ÎÒÃÇÒÔthinking in Java4ÖеÄÀý×ÓΪÀý
´´½¨Á½¸öÀàVectorºÍList¡£½«±àÒëºóµÄVector.classºÍList.classÎļþ·ÅÔÚ°ünet.mindview.simpleÏÂ(¸Ã°üλÓÚc:\DOC\JavaT).
//Vec ......
Ò»¡£javaµÄÓÅÊÆ
1.ÃæÏò¶ÔÏó
2.¿çƽ̨
java×÷ΪһÖÖÍøÂçÓïÑÔ£¬ÆäÔ´´úÂë±»±àÒë³É.class×Ö½ÚÂ룬ÓÉjavaÐéÄâ»úÖ´ÐУ¬
3.¼òµ¥
Ò»£¬java·ç¸ñÀàËÆc++£¬c++³ÌÐòÔ±ÄܺܿìµØÕÆÎÕjava
¶þ£¬javaÞðÆúÁËÖ¸Õ룬½á¹¹£¬Ã¶¾ÙµÈÒ×Òý·¢ÄÚ´æÎÊÌâµÄ²Ù×÷
Èý£¬javaÌṩÁ˷ḻµÄapi£¬Äܹ»°ïÖúÎÒÃÇ¿ìËÙ¿ª·¢
4.½¡×³
Ò»¡£Ç¿ÀàÐ͵ģ¬ÀàÐͼì²éºÜÑ ......
³£¿´µ½ºÜ¶àÈËÌÖÂÛjavaÖйØÓÚStringµÄÎÊÌâ,ÎÒÒ²¾ÍÓеãÐËȤÁË,¼øÓÚÍøÉϺܶàÈËдµÄ¶¼²î±ðºÜ´ó,
ͬÑùµÄÎÊÌⶼÊDz»Í¬µÄ˵·¨,ÎÒºÜÃÔºý,»¨ÁËÒ»ÍíÉ϶ÁÁËJava Virtual Machine SpecificationºÍ
The Java Language SpecificationµÄһЩÕ½Ú,×öÁ˺ܶàÊÔÑé,×ܽáÁËһϹØÓÚStringµÄÄÚÈÝ,»¹
ÓкܶàÄÚÈÝÎÒÒ²²»È·¶¨,ÔÚÏÂÃæÒ²¶¼Ìá³öÀ´ÁË,Ï ......
ÔÎÄ: http://forum.javaeye.com/viewtopic.php?t=17912§Ö÷µÄÎÊÌâÎʵĺ¬º¬ºýºý:flyjie¸ø³öÁ˷dz£ÏêϸµÄ½âÊÍ£¬²»¹ý¾ÍÊÇûÓнâÊÍStringʵÀý»¯µÄÌØÊâ·½ÃæÒÔ¼°Intern()·½·¨µÄº¬Òå----------------------------------------------------------------------------------------------------------------------------------------- ......