Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java µ÷Óà delphi±àдµÄdll


ÓÐЩʱºò,ҪдһЩ³ÌÐò,ÔÚ JAVA ÀïÃæºÃÄÑʵÏÖ, µ«Èç¹ûʹÓÃÆäËü±à³ÌÓïÑÔÈ´ÓֱȽÏÈÝÒ×ʱ,ÎÒÃDz»·Áͨ¹ý JNI À´Èò»Í¬ÓïÑԵijÌÐò¹²Í¬Íê³É.
JNI µÄ½Ì³Ì, ÍøÉÏ C µÄ±È½Ï¶à,Java Ò²ÌṩÁË javah.exe Ϊ C ÓïÑ﵀ JNI ³ÌÐòÉú³ÉÍ·Îļþ, Èç¹ûÄãÊÇÒ»¸ö Delphi ±à³ÌÔ±, ÄÜ·ñÈà JAVA Óë Delphi ³ÌÐò½»»¥ÄØ? ´ð°¸Êǿ϶¨µÄ,½ñÌìÎÒÃǾÍÀ´¿´Ò»ÏÂÒ»¸ö¼òµ¥µÄÀý×Ó.
Helloworld. Ö÷ÒªÊÇÀ´ÈÏʶһÏÂ, JAVA ÔõÑùµ÷Óà Delphi ³ÌÐòµÄ·½·¨.
ºÃµÄ,ÎÒÃÇÏÈÀ´´´½¨Ò»¸öÀà:
package alvinJNI;
class HelloWorld {
static {
System.loadLibrary("DelphiAction"); //µÈÒ»ÏÂÎÒÃǾÍÓÃDelphiÀ´±àÒ»¸ö³ÌÐò,±àºÃÖ®ºóÉú³ÉµÄÎļþ¾ÍÊÇ DelphiAction.dll ÕâÊÇÒ»¸ö¶¯Ì¬Á´½Ó¿âÎļþ,Õâ¸öÀàÀïÏÈÔÚ¾²Ì¬Óï¾ä¿éÖмÓÔØËü
}
public native void printText(); //ÉùÃ÷Ò»¸ö native µÄ±¾µØ´úÂë³ÌÐò,ÎÒÃÇʹÓõÄÊÇ Delphi À´±àд.×¢Òâ:Õâ¸ö·½·¨ÔÚÕâÀïÖ»ÊÇÉùÃ÷,²¢Ã»Óж¨Òå·½·¨Ìå,ÒòΪÕâ¸ö·½·¨ÎÒÃÇÒªÓà Delphi À´ÊµÏÖ.
public static void main(String[] args) {
//´´½¨¶ÔÏó²¢µ÷ÓÃÀïÃæµÄ native ·½·¨.
HelloWorld hw = new HelloWorld();
hw.printText();
}
}
ÀàдÍê±àÒëºó,½ÓÏÂÀ´µÄÊÂÇé¾ÍÓÉ Delphi À´½â¾öÁË
ÎÒÃÇÔËÐÐ Delphi ºóн¨ DLL ¹¤³Ì: file->new->other,È»ºóÔÚ new Ñ¡ÏÀïÃæÑ¡Ôñ Dll Wizard ¾Í´´½¨ÁËÒ»¸öÐµĹ¤³ÌÁË,
ÎÒÃÇÑ¡ÔñÒ»¸öÎļþ¼ÐÀ´±£´æ¹¤³Ì
ÔÚ±£´æ¹¤³Ìºó,ÎÒÃÇÐèÒªÏÂÔØ jni.pas ¼ÓÈëµ½ÎÒÃǵŤ³ÌÖÐ,ÕâÊǹúÍâµÄ¸ßÊÖдµÄ³ÌÐòµ¥Ôª,Ëü·½±ãÎÒÃÇµÄ Delphi ³ÌÐòÓë JAVA ½»»¥. ¿É´ÓÏÂÃæµØÖ·ÏÂÔص½:
http://www.blogjava.net/Files/alvin/jni_pas.zip
½âѹ֮ºóÀïÃæÓÐÁ½¸öÎļþ,½«Æä´æ·ÅÔÚ¹¤³ÌµÄĿ¼ÏÂ
½ÓÏÂÀ´ÎÒÃDZàд Delphi ´úÂë:
library DelphiAction; //ÕâÀïÉèÖö¯Ì¬Á´½Ó¿âµÄÃû³Æ,ÒòΪÎÒÃǸղÅд JAVA ÀàʱÊÇÓà DelphiAction,ËùÒÔÕâÀïÁËÒªÉèÖÃΪ DelphiAction
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be depl


Ïà¹ØÎĵµ£º

JVMÖ¸Áî½âÎöJAVA¶àάÊý×é

ȺÄÚһλÅàѵÀÏʦ·¢³öÀ´Ò»¸öÎÊÌâ:
int[][] a = new int[10][10];
ÕâÖÖ¶àάÊý×é»áÔÚÕ»ÉÏÉú³É¼¸¸ö¶ÔÏó?
Õâ¸öÎÊÌâÐÂÏÊ,ûÈËÎʹý.
·¢³öÀ´ºó ´ó¼Ò¶¼ÈÏΪÓм¸¸öÔªËØ ¾Í»áÉú³É¼¸¸ö¶ÔÏó.
ÎÒ¿ªÊ¼Ò²
ÕâôÈÏΪ.
ÓÚÊÇд¸öÁ˳ÌÐòÊÔÁËÏÂ.·¢ÏÖûÓÐÄÇô¼òµ¥
public static void main(String[] args) {
int[][] a = new int[10][10 ......

JAVAÅÀ³æ

ÕâÊÇÒ»¸öwebËÑË÷µÄ»ù±¾³ÌÐò£¬´ÓÃüÁîÐÐÊäÈëËÑË÷Ìõ¼þ£¨ÆðʼµÄURL¡¢´¦ÀíurlµÄ×î´óÊý¡¢ÒªËÑË÷µÄ×Ö·û´®),
Ëü¾Í»áÖð¸ö¶ÔInternetÉϵÄURL½øÐÐʵʱËÑË÷,²éÕÒ²¢Êä³öÆ¥ÅäËÑË÷Ìõ¼þµÄÒ³Ãæ¡£ Õâ¸ö³ÌÐòµÄÔ­ÐÍÀ´×Ô¡¶java±à³ÌÒÕÊõ¡·£¬
ΪÁ˸üºÃµÄ·ÖÎö£¬Õ¾³¤È¥µôÁËÆäÖеÄGUI²¿·Ö£¬²¢ÉÔ×÷ÐÞ¸ÄÒÔÊÊÓÃjdk1.5¡£ÒÔÕâ¸ö³ÌÐòΪ»ù´¡£¬¿ÉÒÔд³öÔÚ» ......

JAVA±à³Ì¹æ·¶

1. Ó¦Ó÷¶Î§
±¾¹æ·¶Ó¦ÓÃÓÚ²ÉÓÃJ2EE¹æ·¶µÄÏîÄ¿ÖУ¬ËùÓÐÏîÄ¿ÖеÄJAVA´úÂ루º¬JSP£¬SERVLET£¬JAVABEAN£¬EJB£©¾ùÓ¦×ñÊØÕâ¸ö¹æ·¶¡£Í¬Ê±£¬Ò²¿É×÷ΪÆäËüÏîÄ¿µÄ²Î¿¼¡£
2. Éè¼ÆÀàºÍ·½·¨
2.1     ´´½¨¾ßÓкÜÇ¿ÄÚ¾ÛÁ¦µÄÀà
·½·¨µÄÖØÒªÐÔÍùÍù±ÈÀàµÄÖØÒªÐÔ¸üÈÝÒ×Àí½â£¬·½·¨ÊÇÖ¸Ö´ÐÐÒ»¸öͳһº¯ÊýµÄÒ»¶Î´úÂë¡£Àà³£± ......

JAVA¶àÏß³Ì

package debug;import java.io.*;import java.lang.Thread;class MyThread extends Thread{  public int x = 0;  public void run(){    System.out.println(++x);  }}class R implements Runnable{  private int x = 0;  public void run(){    System.out.printl ......

java mail: set

Problem: email thread is hanging at socket read
Today we found a email problem in production, all of the mail threads (3 threads) are hanging/sitting/blocking at same point
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ