• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天下

            記錄修行的印記

            1、Use native code through JNI (HelloWorld)

            https://www.rgagnon.com/topics/java-jni.html

             

            Use native code through JNI (HelloWorld)

            Use native code through JNITag(s): JNI

            With MSVC6, create a new Win32 DLL project (simple) and call it javahowto.

            In the same directory create a java source called JavaHowTo.java 
            class JavaHowTo {
              public native String sayHello();
              static {
                System.loadLibrary("javahowto"); 
              }
            }
            Compile the Java program and use javah utility to generate the JavaHowTo.h header file.
            javah -jni JavaHowTo
            In MSVC6, add the JavaHowTo.h in your project header files
            In the Tools - Options menu, set the include directories to include the Java JNI headers files. They are located in [jdk dir]\include and [jdk dir]\include\win32 directories
            In the javahowto.cpp source, add
            #include "JavaHowTo.h" 

            JNIEXPORT jstring JNICALL Java_JavaHowTo_sayHello
              (JNIEnv *env, jobject obj) {
                return  env->NewStringUTF("Hello world");
            }
            Select the Release configuration and build the project.
            Copy the javahowto.dll in the same directory as the java program.
            Create this new java program
            public class JNIJavaHowTo {
              public static void main(String[] args) {
                JavaHowTo jht = new JavaHowTo();
                System.out.println(jht.sayHello());
                }
            }
            Compile and execute.





            posted on 2019-12-06 10:50 天下 閱讀(286) 評論(0)  編輯 收藏 引用 所屬分類: C/C++Java

            <2019年12月>
            24252627282930
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            導(dǎo)航

            統(tǒng)計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            精品久久久久久无码专区| 亚洲欧洲久久久精品| 久久w5ww成w人免费| 亚洲国产精品久久久久网站| 久久久国产精华液| 一本色道久久88精品综合| AAA级久久久精品无码片| 久久久精品国产亚洲成人满18免费网站| 伊人久久无码精品中文字幕| 精品久久久久久久| 亚洲精品国产综合久久一线| 国产精品一区二区久久| 久久中文字幕人妻熟av女| 久久线看观看精品香蕉国产| 99久久做夜夜爱天天做精品| 亚洲成人精品久久| 久久天堂AV综合合色蜜桃网| 久久亚洲精品国产亚洲老地址 | 久久精品亚洲一区二区三区浴池| 国产精品美女久久久网AV| 97久久超碰成人精品网站| 久久伊人五月丁香狠狠色| 久久青青草原精品国产不卡| 亚洲国产精品久久久久久| 91精品国产综合久久婷婷| 精品久久久中文字幕人妻| 一本色道久久综合狠狠躁篇 | 国产成人精品三上悠亚久久 | 2020久久精品国产免费| 国产69精品久久久久APP下载| 久久久综合香蕉尹人综合网| 国产高清国内精品福利99久久| 99久久久精品| 国内精品久久久久久99| 色狠狠久久AV五月综合| 人妻精品久久久久中文字幕69| 亚洲香蕉网久久综合影视| 久久人人爽人人爽人人片av高请| 久久精品国产99久久无毒不卡 | 亚洲一区精品伊人久久伊人| 久久久久国色AV免费观看|