Copyright (C) 2000-2012 |
Manpages javacSection: User Commands (1)Updated: 2000 ǯ 7 ·î 28 Æü Index Return to Main Contents ̾Á°javac - Java ¥³¥ó¥Ñ¥¤¥é·Á¼°
javac
[
-bootclasspath bootclasspath
]
¥Ñ¥é¥á¡¼¥¿¥ª¥×¥·¥ç¥ó¤Î½ç½ø¤ÏǤ°Õ¤Ç¤¹¡£ÆÃÄê¤Î¥ª¥×¥·¥ç¥ó¤ËŬÍѤµ¤ì¤ë¥Ñ¥é¥á¡¼¥¿¤Ë¤Ä¤¤¤Æ¤Ï¡¢¡Ö¥ª¥×¥·¥ç¥ó¡×Àá¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
µ¡Ç½ÀâÌÀjavac ¥Ä¡¼¥ë¤Ï¡¢Java ¥×¥í¥°¥é¥ß¥ó¥°¸À¸ì¤Çµ½Ò¤µ¤ì¤¿¥¯¥é¥¹¤È¥¤¥ó¥¿¥Õ¥§¡¼¥¹ ¤ÎÄêµÁ¤òÆɤ߼è¤ê¡¢¥Ð¥¤¥È¥³¡¼¥É¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤Ë¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£ ¥½¡¼¥¹¥³¡¼¥É¤Î¥Õ¥¡¥¤¥ë̾¤ò javac ¤ËÅϤ¹¤Ë¤Ï¡¢¼¡¤Î 2 ¤Ä¤ÎÊýË¡¤¬¤¢¤ê¤Þ¤¹¡£
¥½¡¼¥¹¥³¡¼¥É¤Î¥Õ¥¡¥¤¥ë̾¤Ï .java ³ÈÄ¥»Ò¡¢¥¯¥é¥¹¤Î¥Õ¥¡¥¤¥ë̾¤Ï .class ³ÈÄ¥»Ò¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ ¤Þ¤¿¡¢¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤È¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤Î¤É¤Á¤é¤â¡¢³ºÅö¤¹¤ë¥¯¥é¥¹¤ËÂбþ¤·¤¿ ¥ë¡¼¥È̾¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¿¤È¤¨¤Ð¡¢ MyClass ¤È¤¤¤¦Ì¾Á°¤Î ¥¯¥é¥¹¤Ï¡¢ MyClass.java ¤È¤¤¤¦Ì¾Á°¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Ëµ½Ò¤·¤Þ¤¹¡£¤³¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Ï¡¢ MyClass.class ¤È¤¤¤¦Ì¾Á°¤Î¥Ð¥¤¥È¥³¡¼¥É¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤Ë¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Þ¤¹¡£ ÆâÉô¥¯¥é¥¹ÄêµÁ¤Ï¡¢ÄɲäΥ¯¥é¥¹¥Õ¥¡¥¤¥ë¤òÀ¸À®¤·¤Þ¤¹¡£¤³¤ì¤é¤Î¥¯¥é¥¹¥Õ¥¡ ¥¤¥ë¤Î̾Á°¤Ï¡¢ MyClass$MyInnerClass.class ¤Î¤è¤¦¤Ë¡¢ÆâÉô¥¯¥é¥¹Ì¾¤È³°Éô¥¯¥é¥¹Ì¾¤òÁȤ߹ç¤ï¤»¤¿¤â¤Î¤Ë¤Ê¤ê¤Þ¤¹¡£ ¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Ï¡¢¥Ñ¥Ã¥±¡¼¥¸¥Ä¥ê¡¼¤òÈ¿±Ç¤·¤¿¥Ç¥£¥ì¥¯¥È¥ê¥Ä¥ê¡¼¤ËÇÛÃÖ ¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢¤¹¤Ù¤Æ¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò /workspace ¤ËÃÖ¤¤¤Æ¤¤¤ë¾ì¹ç¡¢ com.mysoft.mypack.MyClass ¤Î¥½¡¼¥¹¥³¡¼¥É¤Ï /workspace/com/mysoft/mypack/MyClass.java ¤Ë¤¢¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥³¥ó¥Ñ¥¤¥é¤Ï³Æ¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤òÂбþ¤¹¤ë¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤È Ʊ¤¸¥Ç¥£¥ì¥¯¥È¥ê¤ËÃÖ¤¤Þ¤¹¡£ -d (¸å½Ò¤Î¡Ö¥ª¥×¥·¥ç¥ó¡×¤ò»²¾È) ¤ò»È¤¦¤È¡¢¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Î¤¢¤ë¾ì½ê¤È¤Ï°Û ¤Ê¤ë½ÐÎÏÀè¥Ç¥£¥ì¥¯¥È¥ê¤ò»ØÄê¤Ç¤¤Þ¤¹¡£ ·¿¤Î¸¡º÷¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤È¤¡¢¥³¥ó¥Ñ¥¤¥é¤Ë¤Ï¡¢¤Þ¤Àǧ¼±¤·¤Æ¤¤¤Ê ¤¤·¿¤Ë´Ø¤¹¤ë¾ðÊó¤¬É¬Íפˤʤ뤳¤È¤¬¤¢¤ê¤Þ¤¹¡£¥³¥ó¥Ñ¥¤¥é¤Ë¤Ï¡¢¥½¡¼¥¹ ¥Õ¥¡¥¤¥ë¤Ç»È¤ï¤ì¤Æ¤¤¤ë¥¯¥é¥¹¤Þ¤¿¤Ï¥¤¥ó¥¿¥Õ¥§¡¼¥¹¡¢³ÈÄ¥¤µ¤ì¤Æ¤¤¤ë¥¯¥é¥¹ ¤Þ¤¿¤Ï¥¤¥ó¥¿¥Õ¥§¡¼¥¹¡¢¤¢¤ë¤¤¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¥¯¥é¥¹¤Þ¤¿¤Ï¥¤¥ó¥¿¥Õ¥§¡¼¥¹ ¤½¤ì¤¾¤ì¤Î·¿¾ðÊó¤¬É¬ÍפǤ¹¡£¤³¤ì¤Ë¤Ï¡¢¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ÇÌÀ¼¨Åª¤Ë¤Ï ¸ÀµÚ¤µ¤ì¤Æ¤¤¤Ê¤¯¤Æ¤â¡¢·Ñ¾µ¤òÄ̤¸¤Æ¾ðÊó¤òÄ󶡤¹¤ë¥¯¥é¥¹¤È¥¤¥ó¥¿¥Õ¥§¡¼¥¹ ¤â´Þ¤Þ¤ì¤Þ¤¹¡£ ¤¿¤È¤¨¤Ð¡¢java.applet.Applet ¤ò¥µ¥Ö¥¯¥é¥¹²½¤¹¤ë¾ì¹ç¤Ï¡¢Applet ¤Î¾å°Ì¥¯¥é¥¹¤Ç¤¢¤ë java.awt.Panel¡¢ java.awt.Container¡¢ java.awt.Component ¡¢¤ª¤è¤Ó java.awt.Object ¤â»È¤Ã¤Æ¤¤¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£ ¥³¥ó¥Ñ¥¤¥é¤Ï¡¢·¿¾ðÊó¤¬É¬Íפˤʤë¤È¡¢³ºÅö¤¹¤ë·¿¤òÄêµÁ¤·¤Æ¤¤¤ë¥½¡¼¥¹ ¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤òõ¤·¤Þ¤¹¡£¥³¥ó¥Ñ¥¤¥é¤Ï¡¢¤Þ¤º¡¢¥Ö¡¼¥È¥¹ ¥È¥é¥Ã¥×¥¯¥é¥¹¤È³ÈÄ¥µ¡Ç½¥¯¥é¥¹¤ò¸¡º÷¤·¡¢¼¡¤Ë¥æ¡¼¥¶¥¯¥é¥¹¥Ñ¥¹¤ò¸¡º÷ ¤·¤Þ¤¹¡£¥æ¡¼¥¶¥¯¥é¥¹¥Ñ¥¹¤Ï¡¢ CLASSPATH ´Ä¶ÊÑ¿ô¤òÀßÄꤹ¤ë¤«¡¢¤¢¤ë¤¤¤Ï -classpath ¥³¥Þ¥ó¥É¹Ô¥ª¥×¥·¥ç¥ó¤ò»È¤Ã¤ÆÀßÄꤷ¤Þ¤¹ (¾ÜºÙ¤Ï¡¢¡Ö ¥¯¥é¥¹¥Ñ¥¹¤ÎÀßÄê ¡× ¤ò»²¾È)¡£ -sourcepath ¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¥³¥ó¥Ñ¥¤¥é¤Ï¡¢»ØÄꤵ¤ì¤¿¥Ñ¥¹¤Ç¥½¡¼¥¹ ¥Õ¥¡¥¤¥ë¤ò¸¡º÷¤·¤Þ¤¹¡£¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï¡¢¥æ¡¼¥¶¥¯¥é¥¹¥Ñ¥¹¤Ç¥¯¥é¥¹ ¥Õ¥¡¥¤¥ë¤È¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ÎξÊý¤ò¸¡º÷¤·¤Þ¤¹¡£ -bootclasspath ¥ª¥×¥·¥ç¥ó¤È -extdirs ¥ª¥×¥·¥ç¥ó¤ò»È¤¦¤È¡¢Ê̤Υ֡¼¥È¥¹¥È¥é¥Ã¥×¥¯¥é¥¹¤ä³ÈÄ¥µ¡Ç½¥¯¥é¥¹¤ò»ØÄê ¤Ç¤¤Þ¤¹¡£¸å½Ò¤Î¡Ö ¥¯¥í¥¹¥³¥ó¥Ñ¥¤¥ë¥ª¥×¥·¥ç¥ó ¡×¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£ ·¿¤Î¸¡º÷¤ËÀ®¸ù¤·¤¿¤È¤¤ËÆÀ¤é¤ì¤ë·ë²Ì¤Ï¡¢¥¯¥é¥¹¥Õ¥¡¥¤¥ë¡¢¥½¡¼¥¹¥Õ¥¡¥¤¥ë¡¢¤Þ¤¿¤Ï¤½¤ÎξÊý¤Ç¤¢¤ë¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡£¤½¤ì¤¾¤ì¤Î¾ì¹ç¤Ë javac ¤¬¤É¤Î¤è¤¦¤Ë½èÍý¤ò¹Ô¤¦¤«¤ò¼¡¤Ë¼¨¤·¤Þ¤¹¡£
javac ¤Ï¡¢¥³¥Þ¥ó¥É¹Ô¤Ë»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤È¤¤Ç ¤â¡¢¤½¤Î¤³¤È¤ò¼¨¤¹¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤·¤Þ¤»¤ó¡£¼«Æ°¥³¥ó¥Ñ¥¤¥ë¤ò¥È¥ì¡¼¥¹¤¹ ¤ë¤Ë¤Ï¡¢ -verbose ¥ª¥×¥·¥ç¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ ¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥Èjavac ¥³¥Þ¥ó¥É¤òû¤¯´Ê·é¤Ë¤¹¤ë¤¿¤á¤Ë¡¢³Æ¹Ô¤Ë¥Õ¥¡¥¤¥ë̾¤¬ 1 ¤Äµ½Ò¤µ¤ì¤Æ¤¤ ¤ë¥Õ¥¡¥¤¥ë¤ò 1 ¤Ä¤Þ¤¿¤ÏÊ£¿ô»ØÄꤹ¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¥³¥Þ¥ó¥É¹Ô¤Ç¡¢¥Õ¥¡¥¤ ¥ë̾¤Ë¡Ö@¡×ʸ»ú¤òÉÕ¤±¤ë¤³¤È¤Ë¤è¤ê¡¢»ØÄꤷ¤¿¥Õ¥¡¥¤¥ë¤ò¥Õ¥¡¥¤¥ë¤Î¥ê¥¹¥È¤È¤· ¤Æ»ØÄê¤Ç¤¤Þ¤¹¡£ javac ¤Ï¡¢¡Ö@¡×ʸ»ú¤Ç»Ï¤Þ¤ë°ú¿ô¤ËÁø¶ø¤¹¤ë¤È¡¢¤½¤Î¥Õ¥¡¥¤¥ëÆâ¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë̾ ¤¬¥³¥Þ¥ó¥É¹Ô¤Ë½ñ¤«¤ì¤Æ¤¤¤¿¤«¤Î¤è¤¦¤Ë¡¢¤½¤ì¤é¤Î¥Õ¥¡¥¤¥ë̾¤ËÂФ·¤ÆÁàºî ¤ò¹Ô¤¤¤Þ¤¹¡£ ¤¿¤È¤¨¤Ð¡¢sourcefiles ¤È¤¤¤¦¥Õ¥¡¥¤¥ëÆâ¤Ë¡¢¼¡¤Î¤è¤¦¤Ë¤¹¤Ù¤Æ¤Î¥½¡¼¥¹¥Õ¥¡¥¤ ¥ë̾¤Î¥ê¥¹¥È¤òµ½Ò¤Ç¤¤Þ¤¹¡£
MyClass1.java MyClass2.java MyClass3.java ¼¡¤Î¥³¥Þ¥ó¥É¤ò»È¤Ã¤Æ¡¢¥³¥ó¥Ñ¥¤¥é¤ò¼Â¹Ô¤Ç¤¤Þ¤¹¡£
example% javac @sourcefiles ¥ª¥×¥·¥ç¥ó¥³¥ó¥Ñ¥¤¥é¤Ë¤Ï¡¢¸½ºß¤Î³«È¯´Ä¶¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¡¢¾Íè¤Î¥ê¥ê¡¼¥¹¤Ç¤â ¥µ¥Ý¡¼¥È¤µ¤ì¤ëɸ½à¥ª¥×¥·¥ç¥ó¤Î¥»¥Ã¥È¤¬¤¢¤ê¤Þ¤¹¡£Èóɸ½à¥ª¥×¥·¥ç¥ó¤Î ÊäÂŪ¤Ê¥»¥Ã¥È¤Ï¡¢¸½ºß¤Î Virtual Machine ¤Î¼ÂÁõÆÃͤΤâ¤Î¤Ç¡¢¾Íè Êѹ¹¤µ¤ì¤ë²ÄǽÀ¤¬¤¢¤ê¤Þ¤¹¡£Èóɸ½à¥ª¥×¥·¥ç¥ó¤Ï¡¢ -X ¤Ç»Ï¤Þ¤ê¤Þ¤¹¡£É¸½à¥ª¥×¥·¥ç¥ó
¥¯¥í¥¹¥³¥ó¥Ñ¥¤¥ë¥ª¥×¥·¥ç¥ó¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥¯¥é¥¹¤Î¥³¥ó¥Ñ¥¤¥ë¤Ï¡¢ javac ¤¬ÅºÉÕ¤µ¤ì¤Æ¤¤¤ë JDK ¤Î¥Ö¡¼¥È¥¹¥È¥é¥Ã¥×¥¯¥é¥¹¤ª¤è¤Ó³ÈÄ¥µ¡Ç½¥¯¥é¥¹¤ËÂÐ ¤·¤Æ¹Ô¤ï¤ì¤Þ¤¹¡£¤·¤«¤·¡¢ javac ¤Ï¡¢°Û¤Ê¤ë Java ¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Î¼ÂÁõ¤Î¥Ö¡¼¥È¥¹¥È¥é¥Ã¥×¥¯¥é¥¹¤ª¤è¤Ó³ÈÄ¥ µ¡Ç½¥¯¥é¥¹¤ËÂФ·¤Æ¥³¥ó¥Ñ¥¤¥ë¤ò¹Ô¤¦¡Ö ¥¯¥í¥¹¥³¥ó¥Ñ¥¤¥ë ¡×¤â¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ ¤¹¡£¥¯¥í¥¹¥³¥ó¥Ñ¥¤¥ë¤ò¹Ô¤¦¾ì¹ç¤Ï¡¢ -bootclasspath ¤ª¤è¤Ó -extdirs ¤ò»È¤¦¤³¤È¤¬½ÅÍפǤ¹¡£°Ê²¼¤Î¡Ö¥¯¥í¥¹¥³¥ó¥Ñ¥¤¥ë¤ÎÎã¡×¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
Èóɸ½à¥ª¥×¥·¥ç¥ó
Îã´Êñ¤Ê¥×¥í¥°¥é¥à¤Î¥³¥ó¥Ñ¥¤¥ë¼¡¤Ë¼¨¤¹¥½¡¼¥¹¥Õ¥¡¥¤¥ë Hello.java ¤Ç¤Ï¡¢ greetings.Hello ¤È¤¤¤¦Ì¾Á°¤Î¥¯¥é¥¹¤òÄêµÁ¤·¤Æ¤¤¤Þ¤¹¡£greetings ¥Ç¥£¥ì¥¯¥È¥ê¤Ï¡¢¥½¡¼¥¹ ¥Õ¥¡¥¤¥ë¤È¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤ÎξÊý¤Î¥Ñ¥Ã¥±¡¼¥¸¥Ç¥£¥ì¥¯¥È¥ê¤Ç¡¢¸½ºß¤Î¥Ç¥£¥ì ¥¯¥È¥ê¤Î¤¹¤°²¼¤Ë¤¢¤ê¤Þ¤¹¡£¤³¤Î¤¿¤á¡¢¤³¤ÎÎã¤Ç¤Ï¥Ç¥Õ¥©¥ë¥È¥æ¡¼¥¶¥¯¥é¥¹¥Ñ ¥¹¤ò»ÈÍѤǤ¤Þ¤¹¡£¤Þ¤¿¡¢ -d ¤ò»È¤Ã¤ÆÊ̤νÐÎÏÀè¥Ç¥£¥ì¥¯¥È¥ê¤ò»ØÄꤹ¤ëɬÍפ⤢¤ê¤Þ¤»¤ó¡£
example% ls greetings/ example% ls greetings Hello.java example% cat greetings/Hello.java package greetings; public class Hello { public static void main(String[] args) { for (int i=0; i < args.length; i++) { System.out.println("Hello " + args[i]); } } } example% javac greetings/Hello.java example% ls greetings Hello.class Hello.java example% java greetings.Hello World Universe Everyone Hello World Hello Universe Hello Everyone Ê£¿ô¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Î¥³¥ó¥Ñ¥¤¥ë¼¡¤ÎÎã¤Ï¡¢¥Ñ¥Ã¥±¡¼¥¸ greetings Æâ¤Î¤¹¤Ù¤Æ¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò ¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£
example% ls greetings/ example% ls greetings Aloha.java GutenTag.java Hello.java Hi.java example% javac greetings/*.java example% ls greetings Aloha.class GutenTag.class Hello.class Hi.class Aloha.java GutenTag.java Hello.java Hi.java ¥æ¡¼¥¶¥¯¥é¥¹¥Ñ¥¹¤Î»ØÄê¾å¤ÎÎã¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Î¤¦¤Á¡¢1 ¤Ä¤òÊѹ¹¤·¡¢Êѹ¹¸å¤Î¥Õ¥¡¥¤¥ë¤ò ºÆ¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£
example% pwd /examples example% javac greetings/Hi.java greetings.Hi ¤Ï¡¢greetings ¥Ñ¥Ã¥±¡¼¥¸Æâ¤Î¤Û¤«¤Î¥¯¥é¥¹¤ò»²¾È¤·¤Æ¤¤¤ë ¤¿¤á¡¢¥³¥ó¥Ñ¥¤¥é¤Ï¤³¤ì¤é¤Î¤Û¤«¤Î¥¯¥é¥¹¤òõ¤¹É¬Íפ¬¤¢¤ê¤Þ¤¹¡£¾å¤ÎÎã¤Ç ¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¥æ¡¼¥¶¥¯¥é¥¹¥Ñ¥¹¤¬¡¢¥Ñ¥Ã¥±¡¼¥¸¥Ç¥£¥ì¥¯¥È¥ê¤ò´Þ¤à¥Ç¥£¥ì¥¯¥È ¥ê¤ÈƱ¤¸¤Ê¤Î¤Ç¡¢¥³¥ó¥Ñ¥¤¥ë¤ÏŬÀڤ˹Ԥï¤ì¤Þ¤¹¡£¤¿¤À¤·¡¢¸½ºß¤É¤Î¥Ç¥£¥ì ¥¯¥È¥ê¤Ë¤¤¤ë¤«¤Ë´Ø·¸¤Ê¤¯¥Õ¥¡¥¤¥ë¤ò¥³¥ó¥Ñ¥¤¥ë¤·¤¿¤¤¾ì¹ç¤Ï¡¢¥æ¡¼¥¶¥¯¥é¥¹ ¥Ñ¥¹¤Ë /examples ¤òÄɲ乤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¥æ¡¼¥¶¥¯¥é¥¹¥Ñ¥¹¤Ë¥¨¥ó¥È¥ê¤òÄɲ乤ë¤Ë¤Ï CLASSPATH ¤òÀßÄꤹ¤ëÊýË¡¤â¤¢¤ê¤Þ¤¹¤¬¡¢¤³¤³¤Ç¤Ï -classpath ¥ª¥×¥·¥ç¥ó¤ò»È¤¤¤Þ¤¹¡£
example% javac -classpath /examples /examples/greetings/Hi.java ºÆÅÙ greetings.Hi ¤òÊѹ¹¤·¡¢¥Ð¥Ê¡¼¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤ò»È¤¦¤è¤¦¤Ë¤·¤¿¾ì¹ç ¤Ï¡¢¤³¤Î¥Ð¥Ê¡¼¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤â¥æ¡¼¥¶¥¯¥é¥¹¥Ñ¥¹¤òÄ̤¸¤Æ¥¢¥¯¥»¥¹¤Ç¤¤ë ¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
example% javac -classpath /examples:/lib/Banners.jar \ /examples/greetings/Hi.java greetings Æâ¤Î¥¯¥é¥¹¤ò¼Â¹Ô¤¹¤ë¤Ë¤Ï¡¢greetings ¤È¡¢greetings ¤¬»È¤¦ ¥¯¥é¥¹¤ÎξÊý¤Ë¥¢¥¯¥»¥¹¤Ç¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
example% java -classpath /examples:/lib/Banners.jar greetings.Hi ¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤È¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤ÎʬΥÆäËÂ絬ÌÏ¥×¥í¥¸¥§¥¯¥È¤Î¾ì¹ç¤Ï¡¢¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤È¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤òÊ̤Π¥Ç¥£¥ì¥¯¥È¥ê¤ËÃÖ¤¯¤ÈÊØÍø¤Ê¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£¥¯¥é¥¹¥Õ¥¡¥¤¥ë½ÐÎÏÀè¤òÊÌ¸Ä¤Ë »ØÄꤹ¤ë¤Ë¤Ï¡¢ -d ¤ò»È¤¤¤Þ¤¹¡£¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤¬¥æ¡¼¥¶¥¯¥é¥¹¥Ñ¥¹¤Ë¤Ï¤Ê¤¤¤Î¤Ç¡¢ -sourcepath ¤ò»È¤Ã¤Æ¡¢¥³¥ó¥Ñ¥¤¥é¤¬¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò¸«¤Ä¤±¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë¤· ¤Þ¤¹¡£
example% ls classes/ lib/ src/ example% ls src farewells/ example% ls src/farewells Base.java GoodBye.java example% ls lib Banners.jar example% ls classes example% javac -sourcepath src -classpath classes:lib/Banners.jar \ src/farewells/GoodBye.java -d classes example% ls classes farewells/ example% ls classes/farewells Base.class GoodBye.class ¥³¥Þ¥ó¥É¹Ô¤Ç¤Ï src/farewells/Base.java ¤ò»ØÄꤷ¤Æ¤¤¤Þ¤»¤ó¤¬¡¢¤³¤Î ¥Õ¥¡¥¤¥ë¤â¥³¥ó¥Ñ¥¤¥é¤Ë¤è¤Ã¤Æ¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Æ¤¤¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ ¼«Æ°¥³¥ó¥Ñ¥¤¥ë¤ò¥È¥ì¡¼¥¹¤¹¤ë¤Ë¤Ï¡¢ -verbose ¥ª¥×¥·¥ç¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ ¥¯¥í¥¹¥³¥ó¥Ñ¥¤¥ë¤ÎÎ㤳¤³¤Ç¤Ï¡¢JDK 1.2 javac ¤ò»È¤Ã¤Æ 1.1 VM ¾å¤Ç¼Â¹Ô¤¹¤ë¥³¡¼¥É¤ò¥³¥ó¥Ñ¥¤¥ë¤·¤Þ¤¹¡£
example% javac -target 1.1 -bootclasspath jdk1.1.7/lib/classes.zip \ -extdirs "" OldCode.java -target 1.1 ¥ª¥×¥·¥ç¥ó¤Ë¤è¤ê¡¢À¸À®¤µ¤ì¤ë¥¯¥é¥¹¥Õ¥¡¥¤¥ë¤¬ 1.1 VM ¤Ë¸ß´¹À¤¬¤¢¤ë ¤³¤È¤¬Êݾڤµ¤ì¤Þ¤¹¡£JDK1.2 ¤Ç¤Ï¡¢ javac ¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¤Ç 1.1 ¤Ø¤Î¸ß´¹À¤ò°Ý»ý¤·¤Æ¥³¥ó¥Ñ¥¤¥ë¤ò¹Ô¤¦¤Î¤Ç¡¢¤³¤Î ¥ª¥×¥·¥ç¥ó¤Ï¸·Ì©¤Ë¤ÏɬÍפ¢¤ê¤Þ¤»¤ó¡£¤¿¤À¤·¡¢¥³¥ó¥Ñ¥¤¥é¤Ë¤è¤Ã¤Æ¥Ç¥Õ¥© ¥ë¥È¤¬°Û¤Ê¤ë²ÄǽÀ¤¬¤¢¤ë¤Î¤Ç¡¢¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë½¬´·¤ò¤Ä¤±¤Æ ¤ª¤¯¤È¤è¤¤¤Ç¤·¤ç¤¦¡£
JDK 1.2
javac
¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢1.2 ¤Î¥Ö¡¼¥È¥¹¥È¥é¥Ã¥×¥¯¥é¥¹¤ËÂФ·¤Æ¥³¥ó¥Ñ¥¤¥ë¤ò¹Ô¤¦
¤Î¤Ç¡¢JDK 1.2 ¤Ç¤Ï¤Ê¤¯ JDK 1.1 ¤Î¥Ö¡¼¥È¥¹¥È¥é¥Ã¥×¥¯¥é¥¹¤ËÂФ·¤Æ¥³¥ó¥Ñ¥¤
¥ë¤ò¹Ô¤¦¤è¤¦¤Ë»ØÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£¤³¤ì¤Ï¡¢
-bootclasspath
¤ª¤è¤Ó
-extdirs
¤ò»È¤Ã¤Æ¹Ô¤¤¤Þ¤¹¡£¤³¤Î»ØÄê¤ò¹Ô¤ï¤Ê¤¤¤È¡¢1.1 VM ¤Ë¤Ï¸ºß¤·¤Ê¤¤ 1.2
API ¤ËÂбþ¤·¤¿¥³¥ó¥Ñ¥¤¥ë¤¬¹Ô¤ï¤ì¤ë¤¿¤á¡¢¼Â¹ÔÃæ¤Ë¾ã³²¤¬È¯À¸¤¹¤ë²Ä
ǽÀ¤¬¤¢¤ê¤Þ¤¹¡£
´ØÏ¢¹àÌÜjar(1)¡¢ java(1)¡¢ javadoc(1)¡¢ javah(1)¡¢ javap(1)¡¢ jdb(1)¼¡¤Ë¤Ä¤¤¤Æ¤Ï¡¢Java ¤Î Web ¥µ¥¤¥È¤ò»²¾È¤Þ¤¿¤Ï¸¡º÷¤·¤Æ¤¯¤À¤µ¤¤¡£
IndexThis document was created by man2html, using the manual pages. Time: 04:36:37 GMT, November 10, 2024 |