ʹÓÃIntelliJ IDEA¾ÙÐÐLinux Java¿ª·¢µÄ»ù±¾ÉèÖÃÖ¸ÄÏ
ʹÓÃintellij idea¾ÙÐÐlinux java¿ª·¢µÄ»ù±¾ÉèÖÃÖ¸ÄÏ
СÐò£º
IntelliJ IDEAÊÇÒ»¿îÊ¢ÐеÄJava¼¯³É¿ª·¢ÇéÐΣ¨IDE£©£¬ÆäÇ¿Ê¢µÄ¹¦Ð§ºÍÓѺõÄÓû§½çÃæʹµÃ¿ª·¢Ö°Ô±¿ÉÒÔÔ½·¢¸ßЧµØ±àдºÍµ÷ÊÔJava´úÂë¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinux²Ù×÷ϵͳϾÙÐÐIntelliJ IDEAµÄ»ù±¾ÉèÖã¬ÒԱ㿪·¢JavaÏîÄ¿¡£
Ò»¡¢×°ÖÃIntelliJ IDEA
Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚLinuxϵͳÉÏ×°ÖÃIntelliJ IDEA¡£¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî´Ó¹Ù·½ÍøÕ¾ÏÂÔز¢×°ÖÃ×îа汾µÄIntelliJ IDEA£º
sudo snap install intellij-idea-community --classic
µÇ¼ºó¸´ÖÆ
×°ÖÃÍê³Éºó£¬¿ÉÒÔÔÚÓ¦ÓóÌÐò²Ëµ¥»òÆô¶¯Æ÷ÖÐÕÒµ½IntelliJ IDEA¡£
¶þ¡¢½¨ÉèÐÂÏîÄ¿
ÔÚÆô¶¯IntelliJ IDEAºó£¬ÎÒÃÇÐèÒª½¨ÉèÒ»¸öеÄJavaÏîÄ¿¡£Çëƾ֤ÒÔÏ°취¾ÙÐвÙ×÷£º
Á¬Ã¦Ñ§Ï°¡°JavaÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
Ñ¡Ôñ¡°Create New Project¡±£¨½¨ÉèÐÂÏîÄ¿£©Ñ¡Ïî¡£
ÔÚ¡°New Project¡±£¨ÐÂÏîÄ¿£©¶Ô»°¿òÖУ¬Ñ¡Ôñ¡°Java¡±×÷ΪÏîÄ¿ÀàÐÍ£¬²¢µã»÷¡°Next¡±£¨ÏÂÒ»²½£©¡£
ÔÚ¡°Project SDK¡±£¨ÏîÄ¿SDK£©ÖÐÑ¡ÔñÒÑ×°ÖõÄJava¿ª·¢¹¤¾ß°ü£¨JDK£©¡£
ÊäÈëÏîÄ¿Ãû³ÆºÍÏîĿ·¾¶£¬²¢µã»÷¡°Finish¡±£¨Íê³É£©¡£
Èý¡¢ÉèÖÃJava¿ª·¢ÇéÐÎ
ÔÚ½¨ÉèÐÂÏîÄ¿ºó£¬ÎÒÃÇÐèÒªÉèÖÃJava¿ª·¢ÇéÐΡ£
·¿ª¡°Settings¡±£¨ÉèÖ㩶Ի°¿ò£¬Ñ¡Ôñ¡°Build, Execution, Deployment¡±£¨¹¹½¨¡¢Ö´ÐС¢°²ÅÅ£©Ïµġ°Compiler¡±£¨±àÒëÆ÷£©Ñ¡Ïî¡£
ÔÚ¡°Java Compiler¡±£¨Java±àÒëÆ÷£©²¿·Ö£¬Ñ¡Ôñ׼ȷµÄJava°æ±¾£¬²¢µã»÷¡°OK¡±ÉúÑÄÉèÖá£
ËÄ¡¢ÉèÖð汾¿ØÖÆϵͳ
IntelliJ IDEAÖ§³Ö¶àÖÖ°æ±¾¿ØÖÆϵͳ£¬ÈçGit¡¢SubversionµÈ¡£ÎÒÃÇ¿ÉÒÔÔÚÏîÄ¿Öм¯³ÉËùÐèµÄ°æ±¾¿ØÖÆϵͳ¡£
·¿ª¡°Settings¡±¶Ô»°¿ò£¬Ñ¡Ôñ¡°Version Control¡±£¨°æ±¾¿ØÖÆ£©Ñ¡Ïî¡£
Ñ¡ÔñÄúҪʹÓõİ汾¿ØÖÆϵͳ£¬²¢¾ÙÐÐÏìÓ¦µÄÉèÖá£ÀýÈ磬ÈôÊÇÄúÑ¡ÔñGit£¬ÇëÊäÈëGitµÄ¿ÉÖ´ÐÐÎļþ·¾¶ºÍÓû§Ãû¡£
µã»÷¡°OK¡±ÉúÑÄÉèÖá£
Îå¡¢µ¼ÈëÏÖÓÐÏîÄ¿
ÈôÊÇÄúÒѾÓÐÒ»¸öÏÖÓеÄJavaÏîÄ¿£¬²¢ÇÒÐèÒªÔÚIntelliJ IDEAÖоÙÐпª·¢£¬¿ÉÒÔͨ¹ýÒÔÏ°취µ¼ÈëÏîÄ¿£º
ÔÚIntelliJ IDEAµÄ½Ó´ýÆÁÄ»ÉÏÑ¡Ôñ¡°Import Project¡±£¨µ¼ÈëÏîÄ¿£©Ñ¡Ïî¡£
ÔÚ¡°Import Project¡±¶Ô»°¿òÖУ¬Ñ¡ÔñÏîÄ¿µÄ¸ùĿ¼£¬²¢Ñ¡ÔñÊʵ±µÄ¹¹½¨¹¤¾ß£¨ÈçMaven»òGradle£©¡£
µã»÷¡°OK¡±µ¼ÈëÏîÄ¿¡£
Áù¡¢µ÷ÊÔJava´úÂë
IntelliJ IDEAÌṩÁËÇ¿Ê¢µÄµ÷ÊÔ¹¦Ð§£¬¿ÉÒÔ×ÊÖúÎÒÃÇ¿ìËÙ¶¨Î»Ï¢Õù¾öÎÊÌâ¡£
ÔÚ´úÂë±à¼Æ÷ÖÐÑ¡ÕªÒªµ÷ÊÔµÄJavaÀ࣬²¢ÔÚ×ó²àµÄ±ßÀ¸ÖÐÉèÖöϵ㡣
µã»÷¡°Debug¡±£¨µ÷ÊÔ£©°´Å¥Æô¶¯µ÷ÊԻỰ¡£
ÔÚµ÷ÊԻỰÖУ¬Äú¿ÉÒÔʹÓÃÖÖÖÖµ÷ÊÔ¹¦Ð§£¬Èçµ¥²½Ö´ÐС¢Éó²é±äÁ¿ºÍ±í´ïʽµÄÖµµÈ¡£
Æß¡¢Ê¹ÓôúÂëʾÀý
ÏÂÃæÊÇÒ»¸ö¼òÆÓµÄJava´úÂëʾÀý£¬ÑÝʾÔõÑùʹÓÃIntelliJ IDEA¾ÙÐпª·¢ºÍµ÷ÊÔ£º
public class HelloWorld { public static void main(String[] args) { String message = "Hello, World!"; System.out.println(message); } }
µÇ¼ºó¸´ÖÆ
ÔÚIntelliJ IDEAÖУ¬¿ÉÒÔƾ֤ÒÔÏ°취ʹÓøÃʾÀý´úÂ룺
½¨ÉèÒ»¸öеÄJavaÀàÎļþ£¬²¢½«ÉÏÊö´úÂ븴ÖÆÕ³Ìù½øÈ¥¡£
È·±£ÒÑ׼ȷÉèÖÃJava¿ª·¢ÇéÐκͰ汾¿ØÖÆϵͳ¡£
µã»÷¡°Run¡±£¨ÔËÐУ©°´Å¥Ö´ÐдúÂë¡£
¿ÉÒÔÔÚ¿ØÖÆ̨Öп´µ½Êä³öЧ¹û¡£
½áÂÛ£º
ͨ¹ý±¾ÆªÎÄÕ£¬ÎÒÃÇÏàʶÁËÔõÑùÔÚLinux²Ù×÷ϵͳϾÙÐÐIntelliJ IDEAµÄ»ù±¾ÉèÖã¬ÒÔ¼°ÔõÑù½¨ÉèÐÂÏîÄ¿¡¢ÉèÖÃJava¿ª·¢ÇéÐΡ¢µ¼ÈëÏÖÓÐÏîÄ¿ºÍµ÷ÊÔJava´úÂ롣ϣÍûÕâЩ²Ù×÷Ö¸ÄÏÄܹ»×ÊÖúÄúÔ½·¢¸ßЧµØʹÓÃIntelliJ IDEA¾ÙÐÐJava¿ª·¢¡£
ÒÔÉϾÍÊÇʹÓÃIntelliJ IDEA¾ÙÐÐLinux Java¿ª·¢µÄ»ù±¾ÉèÖÃÖ¸ÄϵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡