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

JNAʵÏÖJavaµ÷ÓÃFortran

Ôڳɹ¦ÊµÏÖJavaµ÷ÓÃC++Ö®ºó£¬½ÓÏÂÀ´Ïëµ½ÄÜ·ñͨ¹ýJNAʵÏÖJavaµ÷ÓÃFortran£¬½ñÌìÊÔÑéÁËһϣ¬»¹ÊDZȽÏÈÝÒ׵ġ£
ÍøÉÏÓÐÒ»¸öJavaµ÷ÓÃF95µÄÀý×Ó£¬µ«ÊÇÎÒ¿¼ÂDz»½öҪʵÏÖF95µÄµ÷Ó㬻¹ÒªÊµÏÖF77µÄµ÷Óã¬ËùÒÔ·ÑÁËһЩÖÜÕÛ¡£
ÎÊÌâµÄ¹Ø¼üÔÚÓÚF77Ϊ¹ý³ÌÃû×Ô¶¯Ìí¼ÓÁËÒ»¸öβ²¿µÄÏ»®Ïߣ¬ËùÒÔsub1Õâ¸ö¹ý³Ì£¬µ½JavaÒ»¶Ë£¬¾Í±ä³ÉÁËsub1_£¬ÖªµÀÁËÕâÒ»µã£¬ºóÃæ¾Í¼òµ¥ÁË¡£
1¡¢´´½¨Ò»¸ö¶¯Ì¬Á´½Ó¿âÏîÄ¿FortranDLL£¬Ð½¨Ò»¸ö¼òµ¥µÄfortranÔ´³ÌÐòfor1.f£º
      subroutine sub1(i)
          INTEGER i;
          PRINT*, "SUB1 CALLED"
          PRINT*, i
      END subroutine
±àÒë´úÂëÉú³ÉlibFortranDLL.dll¡£
2¡¢Ð½¨Ò»¸öJavaÏîÄ¿£¬°üº¬JNA¿â
´´½¨Ò»¸ö¶¯Ì¬¿â½Ó¿Ú´úÂëFLib.java£º
import com.sun.jna.Library;
import com.sun.jna.ptr.ByReference;
public interface FLib extends Library {
    void sub1_(ByReference  i);
}
´´½¨Ò»¸öÖ÷³ÌÐòMain.java
import com.sun.jna.Native;
import com.sun.jna.ptr.IntByReference;
public class Main {
    public static void main(String[] args) {
        // Loading dynamically the library
        FLib lib2 = (FLib) Native.loadLibrary("libFortranDLL", FLib.class);
        IntByReference a = new IntByReference(1234);
        lib2.sub1_(a);
    }
}
×¢Ò⣬¹Ø¼üÔÚÓÚ½Ó¿Úµ±ÖеÄsub_Õâ¸öÃüÃû¹æÔò£¬·ñÔòÎÞ·¨ÕÒµ½ÕÒµ½Ö¸¶¨¹ý³Ì£¬ÁíÍâĬÈÏÇé¿öÏ£¬fortranʹÓÃÒýÓòÎÊý£¬ËùÒÔ²»Äܼòµ¥ÊµÓÃint×÷Ϊ²ÎÊý£¬±ØÐëʵÓÃÒýÓòÎÊý¡£
ÔËÐгÌÐò£¬µÃµ½ÈçϽá¹û£º
run£º
 SUB1 CALLED
 1234
³É¹¦Éú³É£¨×Üʱ¼ä£º1 Ã룩
3¡¢G95µÄµ÷Óøü¼òµ¥Ò»Ð©£¬¿ÉÒÔÖ±½ÓʹÓÃbindÖ¸¶¨Êä


Ïà¹ØÎĵµ£º

Java and XML_¶ÁÊé±Ê¼Ç_2010 05 16

2010-05-16
Èý¡¢½âÎöXMLÎĵµ
l  Xerces½âÎöÆ÷¡¢SAXÀàºÍ½Ó¿Ú
l  SAXÔĶÁÆ÷
n  Ê×ÏÈÒªµÃµ½Ò»¸ö·ûºÏSAX org.xml.sax.XMLReader½Ó¿Ú¹æ·¶µÄÀý×Ó£¬Õâ¸ö½Ó¿Ú¶¨ÒåÁ˽âÎöÐÐΪ²¢ÔÊÐíÉèÖÃijЩÌØÕ÷ºÍÊôÐÔ¡£¸Ã½Ó¿ÚÌæ»»ÁËSAX1.0ÖеÄorg.xml.sax.Parser
import org.apache.xerces.parsers.SAXParser;
import org.xml. ......

ECLIPSE µ÷ÊÔjava Ô´Âë

ÒýÓÃ
1.µã “window”-> "Preferences" -> "Java" -> "Installed JRES"
2.´Ëʱ"Installed JRES"ÓÒ±ßÊÇÁÐ±í´°¸ñ£¬ÁгöÁËϵͳÖÐµÄ JRE »·¾³£¬Ñ¡ÔñÄãµÄJRE£¬È»ºóµã±ßÉ쵀 "Edit..."£¬ »á³öÏÖÒ»¸ö´°¿Ú(Edit JRE)
3.Ñ¡ÖÐrt.jarÎļþµÄÕâÒ»Ï“c:\program files\java\jre_1.5.0_06\lib\rt.jar” ......

java ioϵͳʵÀý½²½â

      ÔÚJAVAÖнøÐÐÎļþµÄ¶Áд²Ù×÷Ö÷ÒªÓõ½ÁËJAVAÖеÄÊäÈëÊä³ö£¨IO£©API£¬Java I/OÌṩÁËÐí¶àAPIÌṩ¶ÔÎļþ£¬Äڴ棬socketµÄ¶ÁдµÈ£¬±¾ÎÄÖ÷Ҫͨ¹ýʵÀýÀ´½²½âÔõÑùÀí½âjavaÖеÄÊäÈëÊä³ö¡£
Ò»£¬»ù±¾¸ÅÄî
   Á÷£¨Stream£©£º
  Á÷ÊÇÒ»ÖÖÓÐÐòµÄ×Ö½ÚÊý¾Ý¶ÔÏó¡£Á÷ÓÖ·ÖΪÊäÈëÁ ......

JAVAµ÷ÓÃDOCÃüÁî

public class test {
 
 public static void main(String argv[]) {
  try {  
   Runtime.getRuntime().exec("cmd /c  del F:\\aaa.txt");     
     } catch (Exception e) {  
   & ......

JavaȨÏÞ¿ØÖƵÄËã·¨

ÕâÀï±ÊÕß½éÉÜÒ»Öֺܳ£Óã¬Ò²±È½ÏרҵµÄȨÏÞ¿ØÖÆ˼·¡£ÕâÀïÓÃjavaÓïÑÔÃèÊö£¬Æäʵ¶¼²î²»¶àµÄ¡£Òª»»³ÉÆäËûµÄÓïÑÔÖ÷£¬×Ô¼º×ªÒ»Ï¾ͿÉÒÔÁË¡£ÎªÁË·½±ãÆð¼û£¬ÎÒÃÇÕâÀﶨÒåa^bΪ£ºaµÄb´Î·½¡£ÕâÀÎÒÃÇΪÿһ¸ö²Ù×÷É趨һ¸öΨһµÄÕûÊýÖµ£¬±ÈÈ磺
ɾ³ý£Á£­£­£­0
Ð޸ģÁ£­£­£­1
Ìí¼Ó£Á£­£­£­2
 
ɾ³ý£Â£­£­£­3
Ð޸ģ£­£­£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ