jni C++

This is a discussion on jni C++ within the C++ Programming forums, part of the General Programming Boards category; so hi basically really confused and new to jni. um basically i have in C jstring str; char * str1 ...

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    192

    jni C++

    so hi basically really confused and new to jni. um basically i have in C

    jstring str;
    char * str1 = getStringhere(); // this just returns a char* of a string in a another // function i created
    str = str1;

    and this works but once i changed it to c++ it says almost the exact same thing
    i get an error like cannot convert char* to _jstring*

    it worked for C y not c++

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,968
    What is the exact error message?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    Well, the languages use somewhat different interfaces, it seems.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  4. #4
    Registered User
    Join Date
    Aug 2009
    Posts
    192
    iono basically that cannot convert char* to *jstring

    do u think if i just have a .cpp program but extern everything into C that the program could compile

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    Quote Originally Posted by kiros88 View Post
    iono basically that cannot convert char* to *jstring

    do u think if i just have a .cpp program but extern everything into C that the program could compile
    Yes, and use the C include file only, of course.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  6. #6
    Registered User
    Join Date
    Aug 2009
    Posts
    192
    Does anyone know a basic code sample of a .cpp being called by java i just want to see an example cuz this is frustrating ive tried extern it and its still not working its complaing bout some of the sytax in my jni funciton but in the end i need a cpp file have the jni native function call so i could easily skip the C stuff if there was an example online or out there that uses .cpp in a simple version that does helloworld

  7. #7
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    Quote Originally Posted by kiros88 View Post
    Does anyone know a basic code sample of a .cpp being called by java i just want to see an example cuz this is frustrating ive tried extern it and its still not working its complaing bout some of the sytax in my jni funciton but in the end i need a cpp file have the jni native function call so i could easily skip the C stuff if there was an example online or out there that uses .cpp in a simple version that does helloworld
    Oh, pity you. Nobody said that programming would be easy, tho! I hate to ask, but did you even RTFM...?
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. array of strings in JNI
    By kiros88 in forum C Programming
    Replies: 2
    Last Post: 07-21-2010, 12:40 PM
  2. Timers
    By Deb in forum C Programming
    Replies: 16
    Last Post: 04-23-2007, 10:15 AM
  3. JNI
    By GoLuM83 in forum C Programming
    Replies: 0
    Last Post: 01-03-2007, 09:53 AM
  4. stdout with JNI
    By GoLuM83 in forum C Programming
    Replies: 4
    Last Post: 12-14-2006, 12:27 PM
  5. Does anybody know how can we use Java to prepare a C HeaderFile
    By arvindkr_1999 in forum C++ Programming
    Replies: 8
    Last Post: 04-28-2004, 03:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21