JAVA ·´Éä
Äú²éѯµÄ¹Ø¼ü´ÊÊÇ£ºnewinstance object initargs ¡£Èç¹û´ò¿ªËÙ¶ÈÂý£¬¿ÉÒÔ³¢ÊÔ¿ìËٰ棻Èç¹ûÏë±£´æ¿ìÕÕ£¬¿ÉÒÔÌí¼Óµ½ËѲء£
(°Ù¶ÈºÍÍøÒ³http://bbs.iaiai.com/forum/read.php?tid=2690µÄ×÷ÕßÎ޹أ¬²»¶ÔÆäÄÚÈݸºÔ𡣰ٶȿìÕÕ½÷ΪÍøÂç¹ÊÕÏʱ֮Ë÷Òý£¬²»´ú±í±»ËÑË÷ÍøÕ¾µÄ¼´Ê±Ò³Ãæ¡£)
Ö÷Ìâ : javaµÄ·´Éä»úÖÆ Ê¹ÓõÀ¾ß©® ¸´ÖÆÁ´½Ó ©®ä¯ÀÀÆ÷Êղة®´òÓ¡
javaµÄ·´Éä»úÖÆ
javaµÄ·´Éä»úÖÆÒ»
ÔÚjavaÀïÃæÓÐÒ»ÖÖ·´Éä»úÖÆreflect£¬ÕâÊÇÆäËüÓïÑÔËùûÓеģ¬¿ÉÒÔ¶¯Ì¬´´½¨¶ÔÏóºÍ·½·¨£¬»¹ÓгÉÔ±±äÁ¿µÈ:
Ò».¶ÔÏó¶¯Ì¬´´½¨µÄ·½·¨ÈçÏ£º
ÎÒÃÇÐèҪʹÓõÄÓÐClassÀàºÍConstructorÀà,»¹ÓÐMethodºÍFieldÀà,¾ßÌåµÄʹÓ÷½·¨ÈçÏ£º
1.ʹÓÃClassÀàµÄClass.forName(String className)·½·¨µÃµ½Ò»¸öClass¶ÔÏó£¬
eg: Class aClass=Class.forName(Foo.class.getName());
»òÕß Class aClass=Class.forName("Foo");
2.µÃµ½Ò»¸öClass¶ÔÏóÖ®ºó£¬ÎÒÃÇ»¹ÐèÒª°ÑËüת»»³ÉÎÒÃÇÐèÒªµÄÀàÐͶÔÏó£¬
eg: Foo foo=(Foo)aClass.newInstance();
×¢Òâ´ËµØ·½µÄnewInstance()·½·¨Ö»Äܵ÷ÓÃFooÀàµÄ¹«ÓÐÎ޲ι¹Ô캯Êý£¬Èç¹ûûÓй¹Ô캯Êý
ÔòʹÓø¸ÀàµÄ¹«ÓÐÎ޲ι¹Ô캯Êý£¬Èç¹û±»ÖØдÁË£¬Ôò»á´´½¨¶ÔÏóʧ°Ü¡£
3.µÃµ½Á˶ÔÏóÖ®ºóÎÒÃǾͿÉÒÔÈÎÒâ°Ú²¼ËýÁË¡£
4.Èç¹ûÎÒÃǵĹ¹Ô캯ÊýÀïÃæÐèÒª´«Èë²ÎÊý£¬Ôõô°ì£¿
ÕâʱºòÎÒÃǾÍÐèҪʹÓÃConstructorÀàÁË£¬´´½¨·½·¨ÈçÏ£º
eg: Constructor ctor = aClass.getDeclaredConstructor(Class[] parameterTypes);
Èç¹ûÎÒÃÇÓÐÕâÑùÒ»¸öÀàÐèÒª¶¯Ì¬´´½¨¶ÔÏó£º
public class BB {
private int baby = 9;
public BB(int b) {
baby = b;
}
/**
* @return Returns the baby.
*/
public int getBaby() {
return baby;
}
/**
* @param baby
* The baby to set.
*/
public void setBaby(int baby) {
this.baby = baby;
}
}
ÄÇôÎÒÃÇÈçºÎÀ´×öÄØ£¿
Integer[] os = new Integer[1];
os[0] = new Integer(6);
Class cls = Class.forName(BB.class.getName());
Constructor ctor = cls.getDeclaredConstructor((new Class[] { int.class }));
BB bbb = (BB) ctor.newInstance(os);
System.out.println(bbb.getBaby());
¶þ.·½·¨µÄ¶¯Ì¬´´½¨£º
¼ÙÉèÉÏÃæµÄBBÀàÐèÒª¶¯Ì¬´´½¨getBaby()·½·¨£¬ÎÒÃǸÃÔõô×ö£¿ÕâʱºòÎÒÃÇÐèҪʹÓõ½
MethodÀàÁË£º
1.¶¨ÒåÒ»¸ö·½·¨m:
eg: Class cls = Cla
Ïà¹ØÎĵµ£º
ÔÚ·ÇjavaÐéÄâ»úÏÂÔËÐÐmatlab¾Ý˵¿ÉÒÔÀ©´óÄÚ´æ,Æô¶¯·ÇjavaÐéÄâ»úÏÂÔËÐÐ matlabµÄ·½·¨ÓУº
Ò».
1¡¢ÓÒ½¨µãmatlab¿ì½Ý·½Ê½£¬Ñ¡ÊôÐÔ ......
×î½üÎÒ·¢ÏÖ²»ÉÙ³õѧÕߣ¬Ñ§Ï°javaµÄʱºò£¬¿´Á˺öàjavaµÄÀúÊ·¡¢ÓŵãºÍÓ¦Ó÷¶Î§¡£¶ÔÓÚÕâЩ֪ʶ£¬²¢²»ÄÑÀí½â¡£ÎÒÒ²µ±È»Í¬ÒâjavaÊÇÒ»ÖÖÓÅÐãµÄ¼ÆËã»úÓïÑÔ¡£µ«ÊǶÔÓÚÎÒÃÇÀ´ËµÒªÁ˽âµÄ²¢²»ÊÇ£¬ÕâЩÀúÊ·µÈ֪ʶ¡£¶øÊÇÕÆÎÕjavaÕâÌ×¼¼Êõ¡£ÒªÏëÕÆÎÕÕâÌ×¼¼Êõʵ¼ùÊǷdz£ÖØÒªµÄ¡£ÄÇôºÜ¶à³õѧÕߣ¬ÔÚµÚÒ»²½Êµ¼ùµÄʱºò¾ÍÓöµ½ÁËÀ§ÄÑ£¬¾ÍÊÇÅäÖà ......
java´úÀíģʽ¼°¶¯Ì¬´úÀíÀà ÊÕ²Ø
¶Ô´úÀíģʽÓëJava¶¯Ì¬´úÀíÀàµÄÀí½â
1. ´úÀíģʽ
´úÀíģʽµÄ×÷ÓÃÊÇ£ºÎªÆäËû¶ÔÏóÌṩһÖÖ´úÀíÒÔ¿ØÖƶÔÕâ¸ö¶ÔÏóµÄ·ÃÎÊ¡£ÔÚijЩÇé¿öÏ£¬Ò»¸ö¿Í»§²»Ïë»òÕß²»ÄÜÖ±½ÓÒýÓÃÁíÒ»¸ö¶ÔÏ󣬶ø´úÀí¶ÔÏó¿ÉÒÔÔÚ¿Í»§¶ËºÍÄ¿±ê¶ÔÏóÖ®¼äÆðµ½ÖнéµÄ×÷Óá£
´úÀ ......
ûÓÐÒ»¸öƽ̨¶ÀÁ¢µÄ·½·¨Äܹ»ÔÚËùÓеÄJVMÉÏʵÏÖ¡£Ò»¸ö×î¼òµ¥¡¢×î½Ó½üÈ¡µÃPIDµÄ°ì·¨ÊÇʹÓãº
ManagementFactory.getRuntimeMXBean().getName() ¡£
È¡µÃµ½µÄ×Ö·û´ÜµÄ¸ñʽΪ[PROCESS_ID]@[MACHINE_NAME]£¬Í¨¹ý½âÎöÕâ¸ö×Ö·û´®¾Í¿ÉÒԵõ½java½ø³ÌµÄPID¡£
ÔÚÒÔÏÂƽ̨ÉϲâÊÔͨ¹ý£º
1¡¢Windows¡¢LinuxÉϵÄSun JDK1.5¡¢JDK6
2¡¢H ......
Blog from http://forum.xda-developers.com/showthread.php?t=552846
I've just pushed new Hero Java app into my rogers build and it works fine.
What you basically need is:
Jbed.apk (install with adb install)
libjbedvm.so (adb push /system/lib) - remember to remount as RW.
I strongly suggest to ......