Recommendation of returning jintArray or jobjectArray

I have a somewhat simple issue I am trying to resolve,
does anyone know how to for example, return a array of integers when a call to a native method is invoked.
I would need to assign a single dimension array of 30 or more integers on the C++ side and either return a jobjectArray or jintArray. This is quite simple but I dont understand all the mechanism to go from java to C++ and then return an object in a Java friendly format from the native C++ code. The difficulty I am having is reference material and understanding syntax like:
env->SetIntArrayRegion( jints, 0, 31, ints );
I see the code and can follow, but I would like to know more about what is going on in the background. I dont have any good reference material. I have scavanged some code off this site regarding returning String arrays or in C++ terms char* arrays.
I see the code but dont really understand all thats going on in the background. If anyone has suggestion on where this reference material would be most accessible, please enlighten me. thanks

You need to buy a book. JNI is not simple. Best book - not great - that I have found is
Essential JNI - Rob Gordon

Similar Messages

  • 5G ipod error message

    Just today my computer sent a message that it could not read my Ipod and recommended I return it to factory specifications--I went through the "5 Rs" Lastly, during the restore process I got "ipod manager internal error" message and would not let me complete the restore. The Ipod is still under warranty. What is the best course of action. If I get a new I pod, will I be able to transfer my music onto it? Any advice would be helpful
    Thanks

    Welcome to Apple Discussions!
    I don't think you need your iPod serviced quite yet.
    Take a look at this...
    iPod Updater for Windows: "Internal manager error" occurs when restoring or updating iPod
    Also, as long as all the music is on your computer, you will be fine.
    btabz

  • Time machine backup from network share

    Hi there,
    I was wondering whether there is a possibility to backup a personal folder on a network drive/share via time machine?
    Anybody?
    Pierre

    This may help, in a backwards way.  When I attempted to attach a Buffalo Technology NAS to my system and use it with Time Machine, I was unable to make it work.  So I contacted Apple Technical Support on the phone and was elevated to talking to one of their Senior Engineers.  He informed me that Apple designed Time Machine to only be compatible with USB and Firewire, and that Apple does NOT support use of Time Machine over an ethernet connection to an NAS.  So he recommended I return my NAS and purchase a USB/Firewire type external drive for use with Time Machine.  Which is what I did and have been happy ever since.
    Hope this helps

  • Eclipse MS-7520 - Unable to boot windows if Dimm slot A1 is used

    I am unable to boot into or install windows XP, Vista (32 and 64 bit) or Windows 7 Beta if I have any memory installed in Slot A1 - it freezes at the windows loading screen (the little green bar gets about 1/3 way across). I am able to press F8 to bring up the windows boot menu but not even safe mode will boot.
    I have 6 ram modules in total. If I populate slots as per the manual only using 4 or 5 modules I have this problem. If I populate only A0 and A1 the problem occurs. If I populate all slots except A1 it boots windows fine every time (with 10GB of RAM).
    When there is a module in slot A1 the BIOS posts fine. Going into Memory-Z shows that the module is there and lists the spd information which matches the other slots. I can even perform a memtest86 (booting dos from USB stick) on the memory and it passes multiple times (shows the full 12Gb with all 6 modules installed). It seems very odd that windows is unable to boot until the module in slot A1 is removed.
    So far I have tried updating the BIOS to the latest version (1.4), cleared the BIOS back to defaults and have even tried setting conservative memory timings and ratios manually (at 4x ratio as suggested in the forums). Tried performing fresh installs with drivers from both the MSI CD and website and running MSI live update.
    I have only had the mainboard for a week but looking through the forum I have been unable to find a fix for this specific issue. I have logged a global support ticket with MSI but since there are quite a few users around the forum I thought someone here may have had a similar issue or could possibly point out something that I may be missing, some some odd setting or something else that I can try?

    Hi.
    I did try to up the voltage all the way from 1.5 to 1.6 but no joy.
    I received a response from MSI which was to try and update to a beta Bios of 1.53. Didn't make any difference unfortunately.
    I have since talked with tech support where I purchased the board from and they have recommended to return the board and have it replaced. (They tested another board in their stock with 12Gb ram similar to mine and said it ran fine)
    I'll post an update when I receive the replacement board
    Oh, and thanks for the tip -  I appreciate it.

  • New Funtional Req-MRP Wizard Option Would Allow For Planning by Warehouse

    The MRP Wizard should only generate recommendations for the warehouse(s) selected. This would allow proper planning by warehouse.
    My client runs multiple warehouses in single database and manages stock levels by those warehouses. The primary reason for buying Business One was to gain efficiencies in data processing. Having the system create purchase orders allows them to consolidate the purchase process. For MRP to work for them the recommendations must follow the warehouse from which the product was ordered, otherwise they will have to split the database into multiple companies, one for each of their 9 warehouses. Currently the recommendation is going to the default warehouse, but the sale could have been made out of any warehouse.
    Now every MRP run has to be reviewed in detail and every sales order that was entered has to be reviewed to insure that the correct warehouse is selected. This is turning what should be a 30 minute job into a 4 hour job, not to mention that the client now has no faith that the data is accurate, since the recommendation could be for a drop ship.
    If the MRP wizard would only show recommendations for the selected warehouse then the client could run one warehouse at a time and better manage and validate the information returned in the recommendation report.
    A company has 3 warehouse; WH1, WH2, WH3. When in the MRP Wizard selection screen selecting specific warehouses only WH3 is selected. The recommendation report returns recommendations that will generate purchase and production orders for WH3 based only on the demand for sales order rows that contain WH3 for purchased items and the production order warehouse code for manufactured items where WH3 is in the production order header. Demand for component items created by production orders would be for the default warehouse and would only appear when their default warehouse is selected.

    Roy,
    I'm Agree with you we have the same problems with a lot of clientes and as you said is a simply change in SBO code.
    We hope that something can help us
    Regards
    Mauricio Rodriguez

  • Video blaster webcam 2 usb windows vista

    I have a videoblaster webcam 2 USB and I could make it works on windows vista as it follows:
    I made a download of the drivers on http://uk.europe.creative.com/support/downloads/download2.asp?MainCategory=&Product=4900&dlcentric =39&Product_Name=WebCam+II&filetype=3&OSName=Windo ws+2000
    and then installed the beta drivers for windows 2000 trough the device manager - I unziped them and put on the desktop and made windows search - the two files stv673. After that I installed the webcam monitor - first I clicked on the file trough the right button of the mouse and acessed properties - on properties compability for windows 2000 and then made it run as administrator - it worked well.

    Manos,
    The Video Blaster Webcam 3 is an archived product. Did you just purchase it? If that is the case, it would recommended to return the product for a newer model.
    The last driver release was back in 2002 and the driver only supports up to Windows XP. There has been no further driver development for this model ever since.

  • IPod Nano Battery

    I just got an iPod nano (4th gen.) yesterday and I charged it until the battery was fully charged. I used the iPod for about 2 hours total today and the battery completely drained. I was playing some games, but mostly listening to music.
    Is this a problem of the battery just starting up, and if so, do I need to charge it a bit more before the battery reaches full capacity, or is there an issue with the hardware itself?

    The reason it is draining so fast is because coverflow is kicking on most likely. You know, the thing that kicks on when you barely move it, and it shows the albums.
    When you turn the device to the side, it shows your albums. Well, this drains the battery big time. I have tested it myself. If I put the hold switch on, and carefully do not allow it to kick into coverflow, I could get 24 hours, but when coverflow kicked on, I would get 2-5 hours.
    The problem is, Apple didn´t ship this Ipod Nano with the ability to disable coverflow, which they should have. The biggest complaint about this device is coverflow, but Apple still has not fixed it. I have been waiting 2 months for them to fix it, and give us the option to disable coverflow, but they still have not. If I were you, I would send some feedback to Apple and tell them to give people the option to disable coverflow, but as it is taking them forever, I don´t know if they will listen or not. I recommend you return the device and either get another brand or get a 3rd generation nano, if you can get your hands on it. The only downside is the max size on the 3rd generation is 8gb, which is why another device from a more responsive company may be in your interests. I have mine on sale at Amazon because I am tired of waiting for Apple to fix it. The funny thing is, I think a lot of people are avoiding buying this device because of all the bad reviews on Amazon about coverflow. Usually, when I sell a device on Amazon, I sell it within a day of listing it. It´s strange that I have not been able to sell it yet. People are ripping this device to pieces on the Amazon reviews because of coverflow, and on this forum, likewise. It should be simple for Apple to fix, but who knows if they will or will not at this point.
    The other problem with coverflow is that it is incredibly annoying, and it makes it hard to adjust the volume. This is a huge flaw. Complain to Apple.
    I am almost 99 percent certain that your low battery is because of coverflow kicking on. It is heavy on video, and anything that displays graphics will eat battery faster than just audio and less graphical movement.

  • JNI problems (findclass and vm error)

    Hi,
    First please apologize if this question has already been asked. I've looked at the archives and I haven't found any answer to these problems. Thanks to take the time to read this quite long post, but I've tried to be sufficiently explicit...
    So, here's what I want to do: in the native code, generate a list (ArrayList) with some integers in it. I must add that I'm not a Java expert.
    Here's the java code calling the native function:
    package be.ac.umrtc;
    public class Main {
         public native List computeRoute(int src, int dst, float reservation)
         static{
              System.loadlibrary("cspf");
         public static void main(String[] args) throws Exception{
         List path = new Main().computeRoute(lsp.getFrom(),lsp.getTo(),lsp.getReservation());
    Now the native code:
    #include <jni.h>
    #include "be_ac_umrtc_Main.h"
    JNIEXPORT void JNICALL Java_be_ac_umrtc_Main_computeRoute(JNIEnv *env, jobject obj, jint src, jint dst, jfloat reservation){
         arraylistClass = (*env)->FindClass(env,"/java/util/ArrayList");
         if (arraylistClass == NULL){
              return NULL; // exception thrown
         cid = (*env)->GetMethodID(env,arraylistClass,"<init>","()V");
         if (cid == NULL){
              return NULL; // exception thrown
         arraylist = (*env)->NewObject(env, arraylistClass, cid);
         tempClass = (*env)->GetObjectClass(env,arraylist);
         jmethodID mid = (*env)->GetMethodID(env,tempClass,"add","(Ljava/lang/Object;)Z");
         while (longListPopBack(&computedroute,&value2)!=-1){
              fprintf(stderr,"Valeur de value: %d\n", value2);
              if (mid==0){
                   return;
              fprintf(stderr,"%d\n", bool = (*env)->CallBooleanMethod(env, arraylist, mid, value2));
    (*env)->DeleteLocalRef(env, arraylistClass);
    return arrayList;
    I get a NoClassDefFoundError on java/lang/ArrayList.
    So, I've tried to pass a List object "path" as argument to the native method (created in java)
    and proceed with:
    arraylistClass = (*env)->GetObjectClass(env,path);
    instead of FindClass.
    It seems to work well, the first call to callBoleanMethod returns 1. But then, the next call in the loop ends in a VM ERROR:
    HotSpot Internal Error, VM Error
    # HotSpot Virtual Machine Error, Internal Error
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Java VM: Java HotSpot(TM) Client VM (1.4.2_03-b02 mixed mode)
    # Error ID: 43113F32554E54494D45110E4350500308
    # Problematic Thread: prio=1 tid=0x08052c30 nid=0x346d runnable
    Heap at VM Abort:
    Heap
    def new generation total 576K, used 0K [0x44df0000, 0x44e90000, 0x452d0000)
    eden space 512K, 0% used [0x44df0000, 0x44df02a8, 0x44e70000)
    from space 64K, 0% used [0x44e80000, 0x44e80000, 0x44e90000)
    to space 64K, 0% used [0x44e70000, 0x44e70000, 0x44e80000)
    tenured generation total 3724K, used 2233K [0x452d0000, 0x45673000, 0x48df0000)
    the space 3724K, 59% used [0x452d0000, 0x454fe540, 0x454fe600, 0x45673000)
    compacting perm gen total 4096K, used 3166K [0x48df0000, 0x491f0000, 0x4cdf0000)
    the space 4096K, 77% used [0x48df0000, 0x49107890, 0x49107a00, 0x491f0000)
    Java Result: 129
    The questions are thus:
    1. why does FindClass not work?
    2. why does the second call to callboleanmethod fails?
    Thanks a lot for your help.
    Olivier

    Thanks, so now I just want to return an array of integers.
    int[] computeRoute(...); in JAVA
    JNIEXPORT jintArray JNICALL Java_be_ac_umrtc_Main_computeRoute(JNIEnv *env, jobject obj, jint src, jint dst, jfloat reservation){
    int intarray[size];
    return intarray;
    does not work
    I've tried casting : return (jintArray) intarray;
    but no success
    How can I create a jintArray? And then how to insert elements in this jintArray? I've seen in the books and the tutorial how to get element from such a jintArray passed as argument... but how to create it (how to fix size when creating it) and how to set elements is not evident to me.
    Thanks for your patience.

  • DUAL LINK CABLE with 30 INCH SCREEN / MACBOOK 2008

    Getting constant flicker on the black areas of the monitor
    why release a $100 cable and not work?
    why release a new monitor connection and not be ready with a working cable?
    what do I do?
    There is a fix for 15 inch macbook pro, i hear with the energy settings but the same settings are not present in the 13 inch macbooks
    This is annoying, I cant work with constant flicker in the dark black areas of the monitor.

    I recommend you return and get another one , the more people do this, the more they will realize there is a major problem
    returns costs Apple $$$.
    I returned and repurchased on a new receipt so I have another 14 days to test this
    I will not keep it until Im sure it works 100%.
    Consider it a 14 day constant trial while they hold my $108.

  • Unable to trade SouthPark for Xbox 360

    It looks like the incorrect item was added to the trade in website. Only the Grand Wizard edition is listed. I was unable to trade in the game last night as the UPC of the game is not the same as the UPC for the CE edition. Could someone please add this so I can trade the item. Thanks

    Hello stoned99,
    Thanks for posting regarding your South Park: The Stick of Truth trade-in attempt.  I am sorry your experience did not go as expected.
    I have reviewed our listing on the trade-in site, and it appears that while the first image does display the Grand Wizard Edition, the listing itself is actually for the standard copy of the game.  This can be confirmed by searching www.BestBuy.com for the pre-owned SKU showing on the trade-in page.
    The store uses a slightly different system, and it looks as though that one specifically calls out the special edition.  In truth, though, all a customer would need to trade in, even with that, is the game discs, so the store should still accept your copy of the game under that listing.  I would recommend you return and request that they complete the trade for you.  If they are concerned about the title being different, showing them the online listing may assist them in completing the trade.
    Thanks again, and please let me know if you have any additional trouble with your trade.
    Best regards,
    Mike|Social Media Specialist | Best Buy® Corporate
     Private Message

  • Casting, generics and unchecked expressions

    Hi
    I'm trying to access a vector of Recommendations held by a Person object, but I don't want to allow direct access to the vector, just the information contained in it
    public Vector<Recommendation> getRecommendations() {
         return((Vector<Recommendation>)recList.clone());
    }The trouble I'm having is that I have to cast the recList.clone() as a Vector<Recommendation> to return a compatible type.
    When I do this, the source compiles with a warning: unchecked cast.
    Could someone explain an unchecked cast and give me a pointer to solving this please? I've not managed to find anything about combining generics and clones in my books. Is there another way of returning a copy of the vector? All I want to do is make the objects in the vector available for viewing, via processing in a servlet, to a jsp.
    Thanks in advance

    YoGee wrote:
    What you are exposing is a Vector with a reference to a clone of the internal data array, you are not cloning the elements in that data array. So basically if you modify an element in one Vector chances are it will be reflected in the other (assuming the element is mutable).Thanks for the reply.
    I should have said that what I want to achieve is:
    make the Vector<Recommendation>recList contents available for viewing, but not expose the objects so that they are able to be changed - so what I have done is not good!
    after some thought, what I really want is this:
    If what you actually want to achieve is a deep clone (i.e. clone the elements in the internal data array) you need to do it yourself by looping through the Vector and cloning each element in it (assuming the elements implement clone properly)so thanks for the help!

  • Using Get-ADUser but 3.0 needs a filter? What changed?

    I'm trying to just do a basic query of AD attributes from a text file of SamAccountNames I have, but I'm upgraded to PowerShell ISE 3.0 and there might be some things new I'm not understanding. 
    I was just trying to do something simple like this; Get-Content C:\Scripts\userabrivs.txt | ForEach { Get-ADUser -Properties * } | Export-csv C:\scripts\Output\adusers1 
    but in ISE it always asks for 
    cmdlet Get-ADUser at command pipeline position 1
    Supply values for the following parameters:
    (Type !? for Help.)
    Filter: 
    I'm not very good at this so can someone help me understand why it needs a filter when I'm just asking it to use the list of SamAccountNames I have in a text file?

    Hi,
    You're never telling Get-ADUser which user you want to return. Try this instead:
    Get-Content .\userList.txt | ForEach {
    Get-ADUser -Identity $_ -Properties *
    } | Export-Csv .\userProperties.csv
    I highly recommend only returning the properties you need, the wildcard will return more information than most people want to look at.
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • Why don't I get iRadio after installing iTunes 11.1.1 using OS X Mountain Lion in the US?

    After installing iTunes 11.1.1 using OS X Mountain Lion, I do not have iRadio (or I cannot find it) in iTunes. Would anyone know a solution? Thanks!

    At this point I recommend selling/returning your iPhone, and getting an older one that still has an older supported iOS.
    Or buying a used or refurbished Mac that will support the iPhone.   http://www.macsales.com/ and http://www.powermax.com/ are both good places to go, and the Apple Store has its own corner of older Macs to go to.   Recognize PowerPC applications are not supported at higher than Mac OS X 10.6.8, and that Macs newer than July 20, 2011 can't run 10.6.8 without serious finagling.   Migrating from old to new Mac also takes some work.
    Recognize you don't have to buy the latest and greatest.  Because if you do, you'll have to always try to make sure the software and hardware are running in sync.   This is the down side of having integrated products.   Eventually it does create older machines that can't run with newer devices.

  • Array store exception -- JNI

    Hi,
    I am trying to return a string array in the native function to java and i get the follwing error when i run the java class file
    Exception in thread "main" java.lang.ArrayStoreException
    at ArrayHandler.returnArray(Native Method)
    at ArrayHandler.main(ArrayHandler.java:10)
    My java and C code are pasted below
    public class ArrayHandler {
    private static native String[] returnArray();
    static{
    System.loadLibrary("Msgimpl");
    public static void main(String args[]) {
    ArrayHandler ah= new ArrayHandler();
    String[] ar = ah.returnArray();
    for (int i=0; i<5; i++) {
    System.out.println("array element"+i+"=" + ar);
    #define WIN32WINNT 0x0400
    #include <windows.h>
    #include <jni.h>
    #include <wincrypt.h>
    #define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
    #include "ArrayHandler.h"
    BOOL APIENTRY DllMain(HANDLE hModule,
    DWORD dwReason, void** lpReserved) {
    return TRUE;
    JNIEXPORT jobjectArray JNICALL
    Java_ArrayHandler_returnArray(JNIEnv *env, jobject obj){
    jobjectArray ret;
    int i;
    char *message[5]= {"first",
         "second",
         "third",
         "fourth",
         "fifth"};
         jclass intArrCls = (*env)->FindClass(env, "[Ljava/lang/String;");
         if (intArrCls == NULL) {
         return NULL; /* exception thrown */
    ret=(jobjectArray)(*env)->NewObjectArray(env,5,intArrCls,(*env)->NewStringUTF(env,""));
    if (ret == NULL) {
              return NULL; /* out of memory error thrown */
    for(i=0;i<5;i++) {
    (*env)->SetObjectArrayElement(env,ret,i,(*env)->NewStringUTF(env,message[i]));
    return(ret);

    I found out the mistake
    jclass intArrCls = (*env)->FindClass(env, "[Ljava/lang/String;"); should have been
    jclass intArrCls = (*env)->FindClass(env, "Ljava/lang/String;");
                                                                                                                                                                                                                                                                                                                                                                   

  • Movement type 317 does not currently support serial number management

    Movement type 317 - support serial number management?
    We are using SAP ECC 6.0. and trying to create a structured material from constituent components with the WM 317. The components are using serial numbers. When we try to post the material document we get an error message:
    u201CMovement type 317 does not currently support Serial number managementu201D
    Movement type 317 does not currently support serial number management
    Message no. IO306
    Diagnosis
    With the help of * under the business operation, the entry in table T156S used here under movement type 317 defines that no serial numbers are supported here.
    System Response
    Termination of the transaction called up.
    Is any new availability which support serial number management in warehouse movement 317?

    Is the scenario relates to Retail ??  Movement Type 317 is used for Creation of a structured material from constituent components (Retail).  Check Note 131969 - Recommendation: Store returns in SAP Retail Release 4.0
    thanks
    G. Lakshmipathi

Maybe you are looking for