Native calls problem

Hi everybody,
Following is my problem --
i am working in linux environment with CLDC 1.0.4 and MIDP 2.0, downloaded from the sun site.
earlier i was using only cldc(kvm). For adding native code, i used to rebuild kvm adding .c files containing native functions in the given makefiles. And that was working fine. but i need to use midp classes, which i am not able to use by giving
KVM_HOME> kvm -classpath ../../api/classes:. testClass
i am not able to use midp classes from testClass, even if i specify it in classpath...
So, in order to use midp classes, i decided to rebuilt midp.. in midp makefiles i added .java files and corresponding .c files in SRC.. it is built without errors, but the entry of the new native function is not done in ROMjavaUnix.c or in nativeFunctionTable.c So, when i call the native function from the midlet, it obviously gives native function not found error..
I will be higly thankful to u, if u can help me in the same. There might be a point which i am missing.
Thanks and Regards,
Retesh

Hi,
I think following shd help u...
Following changes have been done in the MIDP RI 2.0 -
The classes containing the native function declarations are added to the MIDP_HOME/src/share/classes/
The corresponding C source files containing the native function definitions are added to MIDP_HOME/src/share/native/
In MIDP_HOME/build/share/makefiles/Defs.gmk the name of the C source file is added to variable MIDP_DEF_SRC
In MIDP_HOME/build/share/makefiles/Defs.gmk while defining variable MIDP_DEF_SOURCE, the name of the package (in our case urPackage) containing the class which contains the native function declaration is added as
MIDP_DEF_SOURCE:=$(shell find \
$(MIDP_DIR)/src/share/classes/java \
$(MIDP_DIR)/src/share/classes/javax \
$(MIDP_DIR)/src/share/classes/urpackage \
$(MIDP_DIR)/src/share/classes/com/sun/mmedia \
$(MIDP_DIR)/src/share/classes/com/sun/midp \
-name '*.java' | egrep -v 'midp/ssl|$(MIDP_EXCLUDE_CLASSES)')
In Defs.gmk (i don't remember the exact path)
when creating classes.zip the urPackage is given as
     $(ZIP) -qr ../$@ java javax com urPackage);
Regards,
Retesh

Similar Messages

  • Web services server side uses C dll (native calls)

    Hi,
    I developed a web service using JAX-RPC. My implementation class uses native c function calls. Dose anybody know where I should put my C dlls and their dependentcy files on Web service server side (tomcat)? If they should be in the .war file, what kind of path in the war would be?
    I have an exception ocurred, like this
    [java] java.rmi.ServerException: Missing port information
    [java] at com.sun.xml.rpc.client.StreamingSender._raiseFault (StreamingSender.java:357)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:228)
    I think probably it is because of native call problem, since I could get something back if not using native call.
    Anybody has similar experience when developing web service using JAX-RPC and calling native c api functions on server side?
    Thanx in advance!

    Yes, I just tried it again (comment all native call out and just call the method that doesn't use native call, it works).
    So your web service application using jax-rpc and c native dlls works already?
    Can you tell me where you put all the native C DLLs and where I can set java.library.path in tomcat?
    Thank you!

  • Native Call (Java Call C program)

    Hi all,
    I am facing problem on compile the .so file for native call.
    In step by step tutorial, after I compile as :
    cc -G -I/opt/java1.3/include -I/opt/java1.3/include/hp-ux \HelloWorldImp.c -o libhello.so
    Fllowing error occur :
    /usr/ccs/bin/ld: Unsatisfied symbols:
    main (code)
    I am using HP-UX, any hints ?

    I solved the problem.
    Compile method in HP is not equal to Solaris.
    and thus throw that error if I follow the step by step tutorial in Sun's page.
    Details refer to :
    http://www.hp.com/products1/unix/java/infolibrary/prog_guide/java1_3/JNI_java2.html

  • CUCM 9.1 native call queuing - calls stuck in queue

    Hello everyone
    We are using the CUCM 9.1 native call queuing feature for attendants hunt group an have the following problem - if all the attendants are busy, the next arriving call gets into queue, receiving MOH treatment, as described in documentation. But if one or more attendants gets free and ready to receive calls, queued call doesn't get transfered to his/her phone. Logging in additional attendants, logging them in and out again doesn't change anything, once the call got in queue it stays in queue.
    Exact cucm release version is 9.1.1.20000-5.
    Has anyone seen this? Any ideas on what traces/logs to check?

    Hi,
    it seems you hitting this bug  CSCuc16486
    http://tools.cisco.com/Support/BugToolKit/search/getBugDetails.do?method=fetchBugDetails&bugId=CSCuc16486&from=summary
    HTH
    Anas
    please don't forget to rate the helpful posts

  • I am an iphone4 user from United Arab Emirates with home button/MIC not working during call problems..

    hi, i am an iphone4 user from the United Arab Emirates. I got my phone as a gift last September and it was not bundled with any carriers and was a factory unlocked piece. Within one month of usage the home button started misfunctioning. It started registering double clicks as single, triple clicks, etc. (the usual complaint of many countless users of iphone from the time of the release.) I then kind of ignored this problem and continued using the phone.
    With this problem still continuing, comes another one.
    My friend gave me a call yesterday, and we were talking happily for a minute or so and suddenly without any reason my friend failed to hear me. Five minutes was spent trying to make myself heard to him. I tried and i tried and the only solution i could find was tapping the phone gently,but firmly. Then he was able to hear me but then after sometime it was back to the same problem.
    The only solution i found was to tap in th sides.(please note that this is also a common problem with many who have call problems but no voice memo problems.) I tried adding and registering my device to my account but when i try to put in my iphone's serial number,they say that the device number is invalid.
    Now i want to get a solution to this, but since this was a gift piece i do not have any invoice of any sort. I even checked itunes.com/support and was happy to find i still have warranty till september.
    I am confused as to what to do as I was dissappointed to find even a single apple store in the UAE and do not know what do we get in terms of support. Could someone please help me?

    that is exactly the problem. I have no idea as in where this phone originates from. It was gifted to my Dad from a personnel who he was supplying for in the company. My dad then gifted it to me on my birthday. I asked my dad about the phone but he also does not know a thing. He also said that the other guy must have taken the invoice with him as he did not give anything to my dad.
    I checked it in quite a few places (like SharafDG,eMax,Axiom etc., the local electronics suppliers) to track where this phone was originally purchased from( because these people usually take down the IMEI's of the electronic devices they sell), but they all could not help me.
    Now i have no idea what to do and i do not want to spend huge amounts of cash for this matter as i am already in the warranty period. Anyways,thanks for your help in advance, but it would be helpful if you could try to get this solved for me.

  • Stop native call from java

    I know there are topics related to timeout, stop or kill native call but it seems there is no good answer for me.
    I have a java class as the caller to call a native C function with double arrays as input. The C function perform some kind of computation using 3rd party FORTRAN functions. If we terminate the java, how to terminate/stop/or exit the C function?
    Here is the partial of java class
    public class PolyFit {
        public native double[] polyFit(int[]iParams, double[] dParams,
                                        double[] xx, double[] yy, int col);
        static {
            try {
                System.loadLibrary("polylib");
            } catch (UnsatisfiedLinkError e) {
                System.out.println ("Failed to load polylib");
                e.printStackTrace();
        public PolyFit() {
    }The parent java class is a sub class of Thread that calls the PolyFit when running as a thread:
        int col2 = 2;
        for() { //more than 1000 pairs of inputX and inputY
            //iParams, dParams, inputX, inputY are assigned before
             PolyFit polyFit = new PolyFit();
            double[]output = polyFit .polyFit(iParams, dParams, inputX, inputY, col2);
        }Here is native C function (partial)
    #include "PolyFit.h"
    JNIEXPORT jdoubleArray JNICALL Java_org_ciit_stat_PolyFit_polyFit
                (JNIEnv *env, jobject obj, jintArray ja, jdoubleArray jda,
                jdoubleArray jdinX, jdoubleArray jdinY, jint col) {
        jdouble *output;   
        jdoubleArray dbArray = (*env)->NewDoubleArray(env, MAX);
        (*env)->SetDoubleArrayRegion(env, dbArray, MIN, MAX, output);
       free(output);
        return dbArray;
    }Every call of polyFit .polyFit() may take less than 1 millisecond to several second. In case the time exceeds a threadhold, i.e. 10 second, we want to stop the thread. However, I can't find the way to stop or exit the C function.
    Any ideas are highly appreciated.

    This is C code, and since there is no portable way to interrupt C code, there's nothing that can be done. In Unix a SIGINT can do the trick, but only by killing the whole address space. There are some thread APIs that attempt to do this, but they are either very unsafe or require cooperation from the code which is being interrupted.
    Your best bet is to code your CPU-intensive code to check a global (or thread-specific) flag for a requested interrupt, and cleanly exit back to the JNI wrapper, returning a flag value to acknowledge the interruption. A wrapper routine around the native method can then throw a Java exception, or block and retry, or whatever you want it to do.
    Note that Thread.stop is deprecated. There is no earthly way to cleanly interrupt either Java or C code, unless it cooperates with the interrupter.

  • Native call with J2ME

    I can write native calls in C and use them in my J2ME applications. But if the application shall be integrated to a J2ME device, like a mobilephone, can the native calls then work on this device? This means the DLL (the native function) must be placed on the mobilephone.
    Thx /Denker

    Even more interesting, how whould you deploy your native bits (e.g. some sort of library) when you cannot even be sure whether your target does support a file system? Apart from that, I doubt you will get a programming API for your mobile phone (well, Symbian OS (e.g. Nokia 7650) provides one I think).

  • Nokia 6500 call problem

    Hello.
    I have owned a Nokia 6500 slide on the 3 network for just over a year now, it's a decent phone and I've had very few problems with it until recently. The current problem is that when I make or receive a call, there is no audio/volume. Once the call begins to ring or I answer, and it's connected, there is no volume. However, if I change it to loudspeaker, it can be heard perfectly normally as if it were played through loudspeaker (obviously). So in short, the "handset" option of the call is muted. I have checked the obvious thing such as settings and makings sure the call volume was high enough, but there is just no sound at all when on the handset setting of a call. To make a personal call I have to make it in loudspeaker and everyone can hear.
    I also had a problem wiht my contacts, and I downloaded the latest firmware and it fixed that problem. However, the loudspeaker call problem has remained. Usual searching hasn't sufficed, I appear to be the only one wiht this problem. Hopefully somebody can help me out here.
    Thanks in advance,
    Cams

    Take it to the nearest Nokia Care Point. Probably your speaker is damaged.
    Cheers,
    DeepestBlue
    5800 XpressMusic (Rock Stable) | N73 Music Edition (Never Say Die) | 1108 (Old and faithful)
    If you find any post useful, click on the Green "Kudos" Button on the left to say Thank You...

  • BE6000 Native Call Queuing Design Constraints?

    We see the doc wiki has not been updated with any UCM 9.0 native call queuing design constraints.  We would assume that the call queuing at a min would need to meet the MoH design constraint of 50 sessions, since you figure there is a high probability that one call will be queued in each of 50 queues with MoH playing with each.
    http://docwiki.cisco.com/wiki/Supported_System_Capacities
    Is there any other performance impact we should consider or can we ask the doc wiki be updated with design constraints around call queuing?
    Can the BU clarify is that is 50 simultanous MoH streams per cluster, or 50 per server?  We can eliminate the load by going to multicast and IOS distributed MoH for remote sites, but something tells me there probably is a max queued call ceiling we need to consider for this platform.

    At the risk of getting caught up in the pass-by-reference/pass-by-value debate :), simple values (ints chars etc). are passed as values, and modifying them on the C++ side of the procedure call will not modify the values on th java side.
    Possible solutions are:
    1)pass an array of (say) ints. Then, modifying individual values should modify the java-side values (much in the way that the Stream.read(byte[]) functions do.
    2)format up a strin g with your return values, return the string and parse it on the java side.
    3)have fields in the java side that are accessed and modified by your native call.
    4)pass an object with some fields in it. Have the C++ access and modify the object's fields.
    Hope this helps.

  • How to maintain reference across native calls?

    I'm using JNI to interface with an underlying C++ communications library. I am having trouble keeping my connection valid across native calls.
    For example, in one method I connect and save the connection in a global variable, then return. After I connect I would like to call a "send message" method, but when I do I doesn't recognize the saved connection.
    My question is do saved references persist across JNI calls when using the same object, or will all global vars be new ones? If not, does anyone know a way to get around this?
    Thanks for your help

    All JNI references that you create (through calls to NewObject, GetObjectArrayElement, GetObjectField, ...) or that are passed to your native code as parameters are local. That means that they are only valid for the duration of that native call and only on the thread from which that native call was invoked.
    You can create global references from local references using NewGlobalRef. A global reference is valid across all threads and does not have a limited lifetime. You must make sure to release your global references once you are done using them by calling DeleteGlobalRef.
    God bless,
    -Toby Reyelts
    Check out Jace, http://jace.reyelts.com/jace

  • Nokia E6 call problem? Is this issue isolated or h...

    Nokia E6 call problem being mentioned here
    http://forums.reghardware.com/forum/1/2011/06/22/review_smartphones_nokia_e6/
    and here
    http://www.reghardware.com/2011/06/22/review_smartphones_nokia_e6/page6.html
    and here
    http://twitter.com/#!/dw2/status/83099719907282944
    Has this already been fixed with the final release of the phone in the market?

    These seem to be isolated reports,the phone is only released now so some time will be needed to gather info
    If  i have helped at all a click on the white star below would be nice thanks.
    Now using the Lumia 1520

  • Calling problems in ios 8.0.2

    calling problems in ios 8.0.2

    Same - phone locks up and resets itself 5S - frsutrating - did it both with 8.0.0 as well as 8.0.2
    Apple needs to be better than this...

  • Verizon is releasing another update tommorow: ED05 did not fix the miss call problem

    I got  two voice mails today that did not show as missed calls . I call Verizon technical support and ask to speak to a  manager. He told me that several people are still having miss call problems and to expect a new update august 1 which is tommorow. I told him this is the last straw , if this new update doesn't work for me, they are going to have to give me a different phone or release me from my contract. This is so frustrating.

    I called Verizon 2nd level tech support and they assured me there is NO ED06 update's said they haven't even finished rolling out ED05 yet. I think they just told you that to get you off the phone. I also have a Fascinate and have had problems and can't get them to replace my phone with a different device. I want the Droid Charge since it is the only other one that has the AMOLED screen that I originally chose the Fascinate for . They had a program that ended on July 28th the day that ED05 rolled out. They offered the Droidx, the Incredible 2, and the Droid Charge to replace the Fascinates that were having trouble. I had called to report my issues during this replacement program but was not told that it was going on and now they won't give me the Droid Charge because it has expired. I think since there are STILL issues-they need to bring this program back and allow us to get a different phone. I have been a customer of Verizon for 10 years and have 7 lines so I am REALLY disappointed that they can't work with me (or other customers ) especially since it is not something we did to the phone. It is a problem with either Verizon or Samsung. I don't know where to go from here but maybe if they hear enough from others that didn't have any success with ED05 they will start to replace them. I will probably go to a higher level to voice my concern. Let me know if anyone has any success getting a new device especially the Droid Charge.

  • Problem including: thread, native calls, web service

    I have the following problem:
    There is web service (myService) running on a 2-processor machine
    The web service starts a thread (myThread)
    The thread's run calls a native method (myNative).
    The implementation of the native method simply calls a function (myFunc).
    The web service starts the thread and waits for it to end (with join() ).
    The above are summarized in the following:
    myService
    myThread.run()
    myNative()
    myFunc()
    The problem is:
    it seems that while myThread has ended its execution, the myNative function keeps running.
    (e.g. messages of myNative are printed after the end of the execution of myThread)
    Could this be related to the fact that the machine has 2 processors?
    What could be the cause?
    Thank you in advance.

    This is most likely caused by how the native processes standard output streams are implemented. Try using some other form of feedback (i.e. write to a file, or throw up a user dialog box) and you'll most likely see that the native method is indeed returning when you think it should, but the native output stream doesn't show up until later.
    - K

  • Native - Java Method Call problem - "Wrong Method ID..."

    I am writing a 3d game engine using c++, with all the game logic code in Java, for the purpose of making the thing extendible, easily modifyable, etc...
    I am using J2SE JDK 1.2.2.
    Most things work fine (engine-wise), but i have a few questions about problems i am having getting the JNI to work correctly with calls to Java Methods.
    1. If I use FindClass() to get a jclass reference to a named class, I get one number back. If I then instantiate this class, and then call GetObjectClass() with the instance, I get another number, **which doesnt appear to work for anything**. What is going on here? Can the JVM give different jclass numbers for the same class? Is GetObjectClass() supposed to work?
    2. Is AllocObject() alright for instantiating Java objects? It does seem to allocate memory, and method calls work to the new object. I am aware that it doesn't call a constructor, but I like that, seeing as the initialization is handled through a different [network-synchronized] means.
    3. Using a jclass retrieved using FindClass(), which I store in a global variable, I am able to call methods on an instance that I created in a certain function. I then make sure (?) that the GC can't reclaim the class or object memory by getting a NewGlobalReference to both of them [just to be safe]. However, in a later function, I am unable to call methods using my stored method IDs, ["Wrong Method ID....JVM has been asked to shut down this application in an unusual manner..."]. I am also unable to acquire new methodIDs, as the system returns 0xCCCCCCCC for all method ID queries. Obviously, attempting to use those bogus method IDs results in a JVM crash, in a segment called [2 deep in the untraceable depths of JVM.dll] from the JNI CallVoidMethodV() function. Why is this happening? Is the GC getting in there despite my best efforts? Is it illegal to cache methodIDs, jclass references or jobject references? aaarrggh! :)
    Thanks
    Chris Forbes
    Lead Programmer
    Sprocket Interactive
    [email protected]

    Hi Chris,
    I hit the same sort of problem, when writing a JVMDI ( VM debugger hook ), in C++.
    My question remained unanswered too
    http://forum.java.sun.com/thread.jsp?forum=47&thread=461503&tstart=30&trange=30
    I didn't try a call to NewGlobalRef, as you did... but it sounds like it could be what I was missing.
    I've a couple of ideas, but nothing definite for you.
    1) maybe there's more than one classloader, so that multiple copies of the class are loaded
    2) ensure you're compiling your DLL with "quad-word" ( 8 byte ) alignment.
    Otherwise all your JNI references will be misaligned !
    Since the JNI reference maps to a C++ pointer, it's possible that you can't cache any JNI references.
    That's my vague feeling on the subject.
    As a workaround, you may have to keep requesting any JNI references, eg. jclass & jmethod's, as you need them.
    regards,
    Owen

Maybe you are looking for

  • Built-in contacts app missing

    I set up my Sports Watch 42mm Space Grey on Monday, but I can't find the built-in contacts app anymore on the app screen: I can still see it in the iPhone Watch app listed under "My Watch" and change it's settings, but I can't get it to show. I know

  • 2nd monitor color management: Ps v Lr

    Please help me understand the following problem ... but first, my hardware:  Macbook Air (mid-2011) with OS X 10.8, with a NEC wide gamut P221W monitor connected as a secondary display.  The NEC display is calibrated with Spectraview and an X-rite ey

  • Printing Tax Values in Purchase order

    Hello MM Gurus,         What is the configuration required to print the Tax values of BED,Cess etc. in the Purchase order. I have selected "X" in the print column of Tax pricing procedure. But, Tax values are not coming in the print out.          Kin

  • Web Services Wrapper Error : License Does Not Exists

    Hi, We are trying to connect to SAP Business One via the Web Services Wrapper. We installed the "B1WS: B1 Web Services wrapper " on the same machine running SAP. When we try to connect, by either using the WSDL Generator provided with the B1WS applic

  • Mac upgrade to IOS 10.10 won't let me open pscs5.1, help?

    After upgrading to MAC 10.10 I can't open pscs5.1, Can anyone help?