This discussion is archived
1 2 Previous Next 16 Replies Latest reply: Jun 7, 2013 6:16 PM by EJP Go to original post RSS
  • 15. Re: JNI with Visual C++
    gimbal2 Guru
    Currently Being Moderated
    1010268 wrote:
    I referred this link :

    https://www3.ntu.edu.sg/home/ehchua/programming/java/JavaNativeInterface.html

    'link it during execution of the Java code' means java -Djava.library.path=C:\xxx\hello.dll HelloJNI from the link above.
    As far as I know you specify a path where Java should look for natives, not the native itself. So you would set it to "c:\xxx".
  • 16. Re: JNI with Visual C++
    EJP Guru
    Currently Being Moderated
    1010268 wrote:
    I got "Cant find dependent libraries" error when I dynamically linked the Visual C++ generated dll to execute the java program.
    Come on. We've been over this several times. These are linker errors. They didn't happen when you executed the program. They happened when you linked it.
    I got a two page error (sample - xstring:2011:20:error: const class std::basic_string(cahr,std::char_traits<char>.................................) has no member named '_Myres' )
    So it doesn't have a member called '_Myres', and two pages of prior errors. Have you considered investigating that? Rather than confusing everybody including yourself with incorrect terminology? And treating it as a Java problem when it is clearly a C++ problem?
    when I try to link or include the libraries and dependencies required to compile the cpp code into a dll.
    Exactly. Compile time or link time. Nothing to do with execution, and, therefore, nothing to do with Java. Yet. Your Java code compiled. Your C++ code doesn't compile or doesn't link. Fix that. Get C++ help if you need it. But not from here. This is a Java forum.
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points