Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8459117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:15:31+00:00 2026-06-10T13:15:31+00:00

I want to hardcode a 16 byte array in JNI and return it with

  • 0

I want to hardcode a 16 byte array in JNI and return it with a method.

This isn’t working

static jbyteArray JNICALL getKeyBytes(JNIEnv *env, jobject thiz) 
{
    F_LOG;
    Mutex::Autolock _m(sLock);


    jbyteArray result;  
    jbyte* resultType = new jbyte[16];  
    result = (*env)->NewByteArray(env, 16);  //line 214
    resultType = {52, 14, 25, 32, 75, 83, 35, 89, 40, 69, 35, 73, 84, 82, 35, 30};
    (*env)->SetByteArrayRegion(env, result, 0, 16, resultType);
    delete [] resultType;

    return result;
}

I get the following errors

NativeCodeCaller.cpp:214:17: error: base operand of ‘->’ has non-pointer type ‘_JNIEnv’

NativeCodeCaller.cpp:215:78: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x

NativeCodeCaller.cpp:215:78: error: cannot convert "brace-enclosed initializer list>" to ‘jbyte*’ in assignment

NativeCodeCaller.cpp:216:8: error: base operand of ‘->’ has non-pointer type ‘_JNIEnv’

any quick help? 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T13:15:32+00:00Added an answer on June 10, 2026 at 1:15 pm

    The error base operand of '->' has non-pointer type indicates that you should be using . instead of ->.

    So whether you use (*env).NewByteArray(env, 16); or env->NewByteArray(env, 16);. This is the same for line 216.

    You also have another error at the following line (215) saying cannot convert "brace-enclosed initializer list>" to 'jbyte*' in assignment, because the brace syntax for assignment is only valid where you declare the array/pointer (and I think it depends on the compiler too, but I’m not that sure).

    You should try with:

    jbyte resultType[16] = {52, 14, 25, 32, 75, 83, 35, 89, 40, 69, 35, 73, 84, 82, 35, 30};
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP file.php arg1 arg2 Now I want to hardcode arg1 and arg2 into file.php
I dont want to hardcode the name of the package or where it lives
I want to show images on the page but I don't want to hardcode
I want to show images on the page but I don't want to hardcode
I'm trying to write a generic metaclass to track subclasses Since I want this
Im new in this JavaScript world, but i have this problem i want to
I want to just hard code these values into a table. when I try
want to open pdf file when a user clicks on hyperlink shown in gridview
Want to run javascript function from parent window in child window Example I have
Want to open firefox from terminal at linux with firebug enabled // Terminal $

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.