ÔÚLinuxϵͳÉÏʹÓÃNetBeans¾ÙÐпçƽ̨Java¿ª·¢µÄÉèÖü¼ÇÉ
ÔÚlinuxϵͳÉÏʹÓÃnetbeans¾ÙÐпçƽ̨java¿ª·¢µÄÉèÖü¼ÇÉ
¸ÅÊö£º
NetBeansÊÇÒ»¿î¹¦Ð§Ç¿Ê¢ÇÒÒ×ÓÚʹÓõĿçƽ̨¿ª·¢ÇéÐΣ¬ÓÈÆäÊʺÏJava¿ª·¢¡£±¾ÎĽ«ÏÈÈÝÔÚlinuxϵͳÉÏʹÓÃnetbeans¾ÙÐпçƽ̨java¿ª·¢µÄÉèÖü¼ÇÉ£¬×ÊÖú¶ÁÕ߸ü¸ßЧµØ¾ÙÐÐJavaÏîÄ¿¿ª·¢¡£
×¼±¸ÊÂÇ飺
ÔÚ×îÏÈ֮ǰ£¬ÐèҪȷ±£ÒѾÔÚLinuxϵͳÉÏ׼ȷװÖÃÁËNetBeans¡£¿ÉÒÔ´ÓNetBeans¹Ù·½ÍøÕ¾ÏÂÔØ×îа汾²¢Æ¾Ö¤ÌáÐѾÙÐÐ×°Öá£
ÉèÖÃJDK·¾¶£º
ÔÚʹÓÃNetBeans¾ÙÐÐJava¿ª·¢Ö®Ç°£¬ÐèÒªÉèÖÃJDK·¾¶¡£Ê×ÏÈ£¬·¿ªNetBeans²¢µã»÷²Ëµ¥À¸ÖеĔTools”£¬È»ºóÑ¡Ôñ”Options”¡£
½ÓÏÂÀ´£¬ÔÚ”Options”½çÃæÖУ¬Ñ¡Ôñ”Java”Ñ¡Ï£¬È»ºóµã»÷”Add”°´Å¥¡£ÔÚµ¯³öµÄ¶Ô»°¿òÖУ¬ÊäÈëJDKµÄ×°Ö÷¾¶£¬ÀýÈç”/usr/lib/jvm/java-8-openjdk-amd64″¡£µã»÷”OK”ÉúÑÄÉèÖá£
Á¬Ã¦Ñ§Ï°¡°JavaÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
½¨ÉèJavaÏîÄ¿£º
ÉèÖÃÍê³Éºó£¬¿ÉÒÔ×îÏȽ¨ÉèJavaÏîÄ¿¡£µã»÷NetBeansÖ÷½çÃæÉϵĔFile”²Ëµ¥£¬²¢Ñ¡Ôñ”New Project”¡£
ÔÚµ¯³öµÄ¶Ô»°¿òÖУ¬Ñ¡Ôñ”Java”£¬È»ºóÑ¡Ôñ”Java Application”×÷ΪÏîÄ¿ÀàÐÍ¡£µã»÷”Next”°´Å¥¡£
½ÓÏÂÀ´£¬ÊäÈëÏîÄ¿µÄÃû³ÆºÍλÖá£ÔÚ”Project Name”ºÍ”Project Location”×Ö¶ÎÖл®·ÖÌîдÏîÄ¿Ãû³ÆºÍ´æ´¢Î»Öᣵã»÷”Finish”°´Å¥¡£
±àдJava´úÂ룺
½¨ÉèÏîÄ¿ºó£¬¿ÉÒÔ×îÏȱàдJava´úÂëÁË¡£ÔÚÏîÄ¿×ó²àµÄ”Projects”´°¿ÚÖУ¬Õö¿ªÏîÄ¿Ãû³Æ£¬È»ºóË«»÷”src”Îļþ¼Ð£¬ÔÙË«»÷”package”Îļþ¼Ð¡£
ÓÒ¼üµã»÷packageÎļþ¼Ð£¬Ñ¡Ôñ”New”£¬È»ºóÑ¡Ôñ”Java Class”¡£ÔÚµ¯³öµÄ¶Ô»°¿òÖУ¬ÌîдÀàµÄÃû³Æ£¬ÀýÈç”HelloWorld”£¬È»ºóµã»÷”Finish”°´Å¥¡£
ÔÚ±à¼Æ÷ÖбàдJava´úÂ룬ÀýÈ磺
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }
µÇ¼ºó¸´ÖÆ
ÔËÐÐJava³ÌÐò£º
ÔÚ±àдÍêJava´úÂëºó£¬¿ÉÒÔÖ±½ÓÔÚNetBeansÖÐÔËÐгÌÐò¡£µã»÷±à¼Æ÷×óÉϽǵÄÂÌÉ«ÔËÐа´Å¥£¬»òÕßʹÓÿì½Ý¼ü”Shift+F6″À´ÔËÐгÌÐò¡£
ÈôÊÇÒ»ÇÐÕý³££¬¿ØÖÆ̨´°¿Ú½«ÏÔʾ”Hello, World!”¡£
µ÷ÊÔJava³ÌÐò£º
³ýÁËÔËÐгÌÐò£¬NetBeans»¹ÌṩÁËÇ¿Ê¢µÄµ÷ÊÔ¹¦Ð§¡£¿ÉÒÔÔÚ´úÂëÖÐÉèÖöϵ㣬ÒÔ±ãÔÚÔËÐÐÀú³ÌÖÐÔÝÍ£³ÌÐòµÄÖ´ÐУ¬Éó²é±äÁ¿ÖµºÍŲÓÃÕ»µÈÐÅÏ¢¡£
ÒªÉèÖöϵ㣬ֻÐèÔÚ´úÂë±à¼Æ÷µÄ×ó²àµã»÷ÐкÅÇøÓò¡£ÉèÖúöϵãºó£¬ÔËÐгÌÐò²¢´¥·¢¶Ïµãʱ£¬³ÌÐò½«Í£Ôڶϵ㴦²¢ÏÔʾµ÷ÊÔÐÅÏ¢¡£
µ¼ÈëÏÖÓÐÏîÄ¿£º
ÈôÊÇÒѾÓÐÒ»¸öÏÖÓеÄJavaÏîÄ¿£¬²¢ÇÒÏ£ÍûÔÚNetBeansÖоÙÐпª·¢ºÍµ÷ÊÔ£¬¿ÉÒÔʹÓÃNetBeansµÄµ¼È빦Ч¡£
µã»÷NetBeansÖ÷½çÃæÉϵĔFile”²Ëµ¥£¬²¢Ñ¡Ôñ”New Project”¡£ÔÚµ¯³öµÄ¶Ô»°¿òÖУ¬Ñ¡Ôñ”Java”£¬È»ºóÑ¡Ôñ”Java Project with Existing Sources”×÷ΪÏîÄ¿ÀàÐÍ¡£µã»÷”Next”°´Å¥£¬²¢Æ¾Ö¤ÌáÐÑÑ¡ÔñÏîÄ¿Îļþ¼ÐºÍÉèÖá£
×ܽ᣺
±¾ÎÄÏÈÈÝÁËÔÚlinuxϵͳÉÏʹÓÃnetbeans¾ÙÐпçƽ̨java¿ª·¢µÄÉèÖü¼ÇÉ¡£Í¨¹ý׼ȷÉèÖÃJDK·¾¶£¬½¨ÉèJavaÏîÄ¿£¬±àд´úÂ룬ÔËÐгÌÐòºÍµ÷ÊԵȲÙ×÷£¬¶ÁÕß¿ÉÒÔÔ½·¢¸ßЧµØ¾ÙÐÐJavaÏîÄ¿¿ª·¢¡£NetBeansÌṩÁËһϵÁÐÇ¿Ê¢µÄ¹¦Ð§ºÍ¹¤¾ß£¬¿É×ÊÖú¿ª·¢Ö°Ô±ÌáÉý¿ª·¢Ð§ÂʺʹúÂëÖÊÁ¿¡£
ÒÔÉϾÍÊÇÔÚLinuxϵͳÉÏʹÓÃNetBeans¾ÙÐпçƽ̨Java¿ª·¢µÄÉèÖü¼ÇɵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡