• <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 天下 閱讀(293) 評論(0)  編輯 收藏 引用 所屬分類: C/C++Java

            <2025年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            丁香狠狠色婷婷久久综合| 国内精品久久久久久99蜜桃| 99精品伊人久久久大香线蕉| 国产精品美女久久久久久2018| www.久久热.com| 国产精品丝袜久久久久久不卡| 人人狠狠综合88综合久久| 欧美久久久久久| 久久午夜电影网| 一本久道久久综合狠狠躁AV| …久久精品99久久香蕉国产| 精品久久人人妻人人做精品| 国产亚洲精久久久久久无码77777 国产亚洲精品久久久久秋霞 | 中文精品99久久国产 | 精品久久久久中文字| 亚洲色欲久久久综合网| 精品无码人妻久久久久久| 亚洲一级Av无码毛片久久精品| 久久天天躁狠狠躁夜夜躁2O2O | 色青青草原桃花久久综合| 久久国产精品国产自线拍免费 | 久久综合久久综合亚洲| 九九久久99综合一区二区| 久久狠狠爱亚洲综合影院| 精品久久久久久亚洲| 青青草原精品99久久精品66| 久久成人18免费网站| 色综合久久88色综合天天 | 精品久久亚洲中文无码| 久久黄色视频| 国产午夜电影久久| av无码久久久久久不卡网站| 亚洲午夜久久久久久久久电影网 | 国产精品99久久久久久www| 91精品国产乱码久久久久久 | 婷婷国产天堂久久综合五月| 精品人妻伦一二三区久久| 99久久国产亚洲高清观看2024| 日本强好片久久久久久AAA| 久久精品国产男包| 久久这里只精品99re66|