ʹÓÃEclipse¾ÙÐÐEmbedded Linux JavaÓ¦Óÿª·¢µÄ»ù±¾ÉèÖÃÖ¸ÄÏ
ʹÓÃeclipse¾ÙÐÐembedded linux javaÓ¦Óÿª·¢µÄ»ù±¾ÉèÖÃÖ¸ÄÏ
СÐò£º
Ëæ×ÅǶÈëʽLinuxµÄÆÕ±éÓ¦Óã¬Ê¹ÓÃJavaÓïÑÔ¾ÙÐÐǶÈëʽ¿ª·¢Ò²±äµÃÔ½À´Ô½Æձ顣¶øEclipse×÷Ϊһ¸ö¹¦Ð§Ç¿Ê¢µÄ¼¯³É¿ª·¢ÇéÐΣ¬¿ÉÒÔÌṩ¿ª·¢Õ߸»ºñµÄ¹¤¾ßºÍ²å¼þÀ´¼ò»¯¿ª·¢Àú³Ì¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚEclipseÉÏÉèÖÃǶÈëʽLinux JavaÓ¦ÓõĿª·¢ÇéÐΣ¬²¢¸½´ø´úÂëʾÀý¡£
×¼±¸ÊÂÇ飺
×°ÖÃEclipse£º´Ó¹ÙÍøÏÂÔØ×îа汾µÄEclipse£¬Æ¾Ö¤²Ù×÷ϵͳ¾ÙÐÐ×°Öá£
ÉèÖÃJava¿ª·¢ÇéÐΣºÈ·±£ÒѾװÖÃÁËJDK£¬²¢ÉèÖúÃÁËJAVA_HOMEÇéÐαäÁ¿¡£
°ì·¨Ò»£º×°ÖÃC/C++¿ª·¢²å¼þ
·¿ªEclipse²¢Ñ¡Ôñ”Help” -> “Eclipse Marketplace”¡£
ÔÚ”Eclipse Marketplace”¶Ô»°¿òÖÐËÑË÷”CDT”£¬Ñ¡Ôñ”CDT”²å¼þ²¢µã»÷”Go”¡£
µã»÷”Go”°´Å¥ºó£¬Ñ¡ÔñÊʺÏÄúEclipse°æ±¾µÄCDT²å¼þ²¢µã»÷×°Öá£
×°ÖÃÍê³Éºó£¬ÖØÆôEclipse¡£
°ì·¨¶þ£ºÉèÖý»Ö¯±àÒ빤¾ßÁ´
Á¬Ã¦Ñ§Ï°¡°JavaÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
·¿ªEclipse²¢Ñ¡Ôñ”Window” -> “Preferences”¡£
ÔÚPreferences¶Ô»°¿òÖУ¬Õö¿ª”C/C++”£¬Ñ¡Ôñ”Build” -> “Environment”¡£
µã»÷”Add”°´Å¥²¢Ìí¼ÓÒÔÏÂÇéÐαäÁ¿£º
PATH£º½»Ö¯±àÒ빤¾ßÁ´µÄ·¾¶£¬ÀýÈç/usr/local/arm-linux-gnueabi/bin¡£
C_INCLUDE_PATH£º½»Ö¯±àÒ빤¾ßÁ´µÄÍ·Îļþ·¾¶£¬ÀýÈç/usr/local/arm-linux-gnueabi/include¡£
CPLUS_INCLUDE_PATH£º½»Ö¯±àÒ빤¾ßÁ´µÄC++Í·Îļþ·¾¶£¬ÀýÈç/usr/local/arm-linux-gnueabi/include/c++¡£
µã»÷”OK”ÉúÑÄÉèÖá£
°ì·¨Èý£º½¨ÉèǶÈëʽLinux JavaÏîÄ¿
·¿ªEclipse²¢Ñ¡Ôñ”File” -> “New” -> “Project”¡£
ÔÚ”New Project”¶Ô»°¿òÖÐÑ¡Ôñ”Java Project”£¬²¢µã»÷”Next”¡£
ÊäÈëÏîÄ¿Ãû³ÆºÍλÖ㬲¢µã»÷”Next”¡£
ÔÚ”Source folders on build path”ÖÐÑ¡ÕªÒª°üÀ¨µÄÔ´´úÂëÎļþ¼Ð£¬²¢µã»÷”Finish”¡£
ÏîÄ¿½¨ÉèÍê³Éºó£¬ÓÒ¼üµã»÷ÏîÄ¿²¢Ñ¡Ôñ”Properties”¡£
ÔÚÏîÄ¿ÊôÐÔ¶Ô»°¿òÖÐÑ¡Ôñ”Java Build Path” -> “Libraries” -> “Add Library”¡£
Ñ¡Ôñ”JRE System Library”£¬µã»÷”Next”¡£
Ñ¡ÔñÒÑ×°ÖõÄJDK£¬²¢µã»÷”Finish”¡£
°ì·¨ËÄ£ºÌí¼ÓǶÈëʽLinux¿âÎļþ
ÔÚÏîÄ¿ÊôÐÔ¶Ô»°¿òÖÐÑ¡Ôñ”Java Build Path” -> “Libraries” -> “Add Library”¡£
Ñ¡Ôñ”User Library”£¬µã»÷”Next”¡£
µã»÷”User Libraries” -> “New”£¬ÊäÈëн¨¿âµÄÃû³Æ£¬ÀýÈç”EmbeddedLib”¡£
µã»÷”Add External JARs”²¢Ñ¡ÔñÄúÐèҪʹÓõÄLinux¿âÎļþ¡£
µã»÷”OK”ÉúÑÄÉèÖá£
°ì·¨Î壺ÉèÖÃÔ¶³Ìµ÷ÊÔ
ÔÚEclipseµÄ¹¤¾ßÀ¸ÖÐÑ¡Ôñ”Run” -> “Debug Configuration”¡£
ÔÚ”Debug Configuration”¶Ô»°¿òÖÐÑ¡Ôñ”Remote Java Application”£¬µã»÷”New”¡£
ÊäÈëÉèÖÃÃû³ÆºÍÅþÁ¬ÐÅÏ¢£º
Project£ºÑ¡ÔñÄú½¨ÉèµÄJavaÏîÄ¿¡£
Connection Type£ºÑ¡Ôñ”Standard (Socket Attach)”¡£
Host£ºÊäÈëǶÈëʽLinux×°±¸µÄIPµØµã¡£
Port£ºÊäÈëǶÈëʽLinux×°±¸µÄµ÷ÊԶ˿ںš£
µã»÷”Apply”ÉúÑÄÉèÖá£
´úÂëʾÀý£º
ÏÂÃæÊÇÒ»¸ö¼òÆÓµÄǶÈëʽLinux JavaÓ¦ÓÃʾÀý£¬ÓÃÓÚÔÚÖÕ¶ËÊä³ö”Hello World”¡£
import java.io.*; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }
µÇ¼ºó¸´ÖÆ
×ܽ᣺
±¾ÎÄÏÈÈÝÁËÔõÑùÔÚEclipseÉÏÉèÖÃǶÈëʽLinux JavaÓ¦ÓõĿª·¢ÇéÐΣ¬²¢ÌṩÁËһЩ»ù±¾µÄÉèÖð취ºÍ´úÂëʾÀý¡£Ï£ÍûÕâ¸öÖ¸ÄÏÄܹ»×ÊÖú¿ª·¢Õß¿ìËÙÈëÃÅǶÈëʽLinux JavaÓ¦ÓõĿª·¢¡£ÈôÊÇÓÐÈκÎÎÊÌâ»òÒÉÐÄ£¬ÇëËæʱÔÚÏ·½ÁôÏÂ̸ÂÛ¡£Ð»Ð»ÔĶÁ£¡
ÒÔÉϾÍÊÇʹÓÃEclipse¾ÙÐÐEmbedded Linux JavaÓ¦Óÿª·¢µÄ»ù±¾ÉèÖÃÖ¸ÄϵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡